Processing can find the data folder in Windows 11 but not in Linux or Mac

If you’re going to stick an “=“ sign in there why not just use:

PApplet.runSketch(new String[]{ sketchPath(), "" },this);

That works too on my mac.

It’s expecting the name of the class that extends PApplet and that’s what this.getClass().getSimpleName() does. If the name of your class is “TestWindow“ and you use

 PApplet.runSketch(new String[]{"TestWindow"},this);

that will work too (on a mac, not tested on other platforms).

Actually you can get by with only this:

PApplet.runSketch(new String[]{""},this);

In summary, using sketchPath() in a PApplet returns only a forwardslash on my system and is worthless. I’m sticking with my last snippet unless someone has a compelling reason to change.

If you want to confirm my findings here is a test app that you may run:

class TestWindow extends PApplet {
  TestWindow () {
  PApplet.runSketch(new String[]{""},this);
  }

  void settings() {
    size(200, 200);
  }

  void setup() {
    background(106);
    println("className = ",this.getClass().getSimpleName() );
    println("ARGS_SKETCH_FOLDER =",ARGS_SKETCH_FOLDER);
    println("sketchPath = ",sketchPath());   
    printArray(new String[]{ ARGS_SKETCH_FOLDER + sketchPath(), ""});
    println("dataPath = ",dataPath(""));
  }
}

TestWindow testWindow;

void setup() {
  surface.setVisible(false);
  testWindow = new TestWindow();
}

Mac Output:

Note that dataPath() doesn’t work inside of a PApplet either which is why the OP’s Mac friend couldn’t use loadImage() as expected.