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

**URL:** <https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [November 2, 2025, 8:48pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472 "2025-11-02T20:48:54Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![ffernandaffranco](https://avatars.discourse-cdn.com/v4/letter/f/46a35a/32.png) [@ffernandaffranco](https://discourse.processing.org/u/ffernandaffranco)\
**Post date:** [November 3, 2025, 7:18pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/23 "2025-11-03T19:18:31Z")

</div>

I will do so tomorrow by describing the problem in more detail and asking my colleagues exactly which versions of OS and Processing they have.

The only thing that changed from the original project I uploaded was in the Main.pde file, so I will make sure to document the changes in the solution thoroughly.

Thank you!!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 4, 2025, 7:56am UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/24 "2025-11-04T07:56:32Z")

</div>

Use constant `{ ARGS_SKETCH_FOLDER + sketchPath(), "" }` array as the 1st argument for **runSketch()** to instantiate extra PApplet subclasses:

> [@Problems when trying to draw to a P3D PGraphics when called from a thread?](https://discourse.processing.org/t/problems-when-trying-to-draw-to-a-p3d-pgraphics-when-called-from-a-thread/6301/4):
>
> Although it’s pretty much a hack, here’s the workaround I’ve come up w/: crazy_face /\*\* \* Threaded PGraphics II (v1.0.1) \* GoToLoop (2018/Dec/07) \* \* https://Discourse.Processing.org/t/ \* problems-when-trying-to-draw-to-a-p3d-pgraphics- \* when-called-from-a-thread/6301/4 \* \* https://Forum.Processing.org/two/discussion/25799/ \* how-to-draw-a-rect-in-a-thread#Item\_2 \*/ static final int W = 250, H = 200, FPS = 10; Layer layer; void settings() { size(W, H, JAVA2D); smooth(3); } v…

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 4, 2025, 2:14pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/25 "2025-11-04T14:14:00Z")

</div>

What advantage does:

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

```

have over:

```processing
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);

```

?

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 4, 2025, 4:04pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/26 "2025-11-04T16:04:40Z")

</div>

> [@GoToLoop](#):
>
> Use constant `{ ARGS_SKETCH_FOLDER + sketchPath(), "" }` array as the 1st argument for **runSketch()** to instantiate extra PApplet subclasses

Hello @GoToLoop,

Cool beans! Adding this to my Processing notes.

I had to add an `=` sign for this to work with `sketchPath()` in `layer` in your code (`subsketch_0` in my code):

`final String[] switches = { ARGS_SKETCH_FOLDER + "=" + sketchPath(), "" };`

The `sketchPath()` is the same for each now:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/c/c/cc6951576e6082d2fb2028e21e05a7cb77c94524.png)

This is what the output is without passing the `ARGS_SKETCH_FOLDER`:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/5/0/50ddc8e4d3e5282a8bf8823e2da9b992e261de4a.png)

Thanks for sharing!

`:)`

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 4, 2025, 4:20pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/27 "2025-11-04T16:20:11Z")

</div>

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

```processing
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

```processing
 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:

```processing
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:

```processing
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:**

 ![dp](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/9/e/9e43dd49f0f6a7bd51d6081f233caaf6cf9d2eec.png)

**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.**

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 4, 2025, 7:09pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/28 "2025-11-04T19:09:03Z")

</div>

> [@svan](#):
>
> If you’re going to stick an “=“ sign in there why not just use:
> 
> ```auto
> PApplet.runSketch(new String[]{ sketchPath(), "" },this);
> 
> ```

Hello @svan,

The context of my previous response was to this topic and the code provided:

> [@GoToLoop](#):
>
> Use constant `{ ARGS_SKETCH_FOLDER + sketchPath(), "" }` array as the 1st argument for **runSketch()** to instantiate extra PApplet subclasses:

_Environment is Windows 10 with Processing 4.4.10 for this post._

I modified the code you provided [here](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/27) for the context above:

```processing
TestWindow testWindow;

void setup() {
  surface.setVisible(false);
  testWindow = new TestWindow();
  final String[] switches = { ARGS_SKETCH_FOLDER + "=" + sketchPath(), "" }; // With sketchPath() ... An = sign is required!
  //final String[] switches = { "" }; // Added an = sign // Without sketchPath 
  
  println("Main sketch:");
  println("className = ", this.getClass().getSimpleName() );
  println("ARGS_SKETCH_FOLDER =", ARGS_SKETCH_FOLDER);
  println("sketchPath = ", sketchPath()); 
  printArray(switches);
  //printArray(new String[]{ ARGS_SKETCH_FOLDER + sketchPath(), ""}); // You can see that this is missing an = sign
  println("dataPath = ", dataPath(""));
  println();
  
  runSketch(switches, testWindow = new TestWindow());
  }

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

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

  void setup() {
    background(106);
    println("testWindow:");
    println("className = ", this.getClass().getSimpleName() );
    println("ARGS_SKETCH_FOLDER =", ARGS_SKETCH_FOLDER);
    println("sketchPath = ", sketchPath());
    println(ARGS_SKETCH_FOLDER + "=" + sketchPath()); // The = sign added that is required
    printArray(new String[]{ ARGS_SKETCH_FOLDER + sketchPath(), ""}); // You can see that this is missing an = sign
    println("dataPath = ", dataPath(""));
  }
}

```

Output _PASSING_ the `sketchPath()`:

```auto
Main sketch:
className = Testing
ARGS_SKETCH_FOLDER = --sketch-path
sketchPath = D:\Users\GLV\Documents\Processing\PF_Testing
[0] "--sketch-path=D:\Users\GLV\Documents\Processing\PF_Testing"
[1] ""
dataPath = D:\Users\GLV\Documents\Processing\PF_Testing\data

testWindow:
className = TestWindow
ARGS_SKETCH_FOLDER = --sketch-path
sketchPath = D:\Users\GLV\Documents\Processing\PF_Testing
--sketch-path=D:\Users\GLV\Documents\Processing\PF_Testing
[0] "--sketch-pathD:\Users\GLV\Documents\Processing\PF_Testing"
[1] ""
dataPath = D:\Users\GLV\Documents\Processing\PF_Testing\data

```

Output _NOT PASSING_ the `sketchPath()`:

```auto
Main sketch:
className = Testing
ARGS_SKETCH_FOLDER = --sketch-path
sketchPath = D:\Users\GLV\Documents\Processing\PF_Testing
[0] ""
dataPath = D:\Users\GLV\Documents\Processing\PF_Testing\data

testWindow:
className = TestWindow
ARGS_SKETCH_FOLDER = --sketch-path
sketchPath = D:\Program_Portable\Processing-4.4.10
--sketch-path=D:\Program_Portable\Processing-4.4.10
[0] "--sketch-pathD:\Program_Portable\Processing-4.4.10"
[1] ""
dataPath = D:\Program_Portable\Processing-4.4.10\data

```

> [@svan](#):
>
> If you want to confirm my findings here is a test app that you may run:

This is the output on W10 with Processing 4.4.10 of your demo:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/7/5/75a042879c8bb8a0867aca2e18ba53ffc2d0e3ca.png)

One more method and my last one:

> **Code hidden here!**
>
> ```processing
> /*
> * Launcher for Multi-Renderer PApplets
> *
> * Author: glv
> * Date: 2025-11-04
> *
> */
> 
> // Renderer Applets:
> renderApp_0 app_0; // JAVA2D
> 
> void settings() {
> size(200, 200);
> }
> 
> void setup() {
> surface.setTitle("Launcher");
> println("Main sketch:", sketchPath());
> 
> // app_0 Lambda Thread (active)
> app_0 = new renderApp_0();
> final String[] switches = { ARGS_SKETCH_FOLDER + "=" + sketchPath(), // With sketchPath()
> "renderapp_0" };
> Thread thread_0 = new Thread(() -> PApplet.runSketch(switches, app_0));
> //Thread thread_0 = new Thread(() -> PApplet.runSketch(new String[]{"renderapp_0"}, app_0)); //// Without sketchPath()
> thread_0.start();
> }
> 
> void draw() {
> background(255);
> translate(width/2, height/2);
> 
> fill(0);
> textSize(24);
> textAlign(CENTER, CENTER);
> text("Launcher JAVA2D", 0, 0);
> }
> 
> // JAVA2D
> class renderApp_0 extends PApplet {
> void settings() {
> size(200, 200);
> }
> 
> void setup() {
> surface.setTitle("Launcher");
> println("RenderApp_0:", sketchPath());
> }
> 
> void draw() {
> background(255);
> translate(width/2, height/2);
> 
> fill(0);
> textSize(24);
> textAlign(CENTER, CENTER);
> text("JAVA2D", 0, 0);
> }
> }
> 
> ```

`:)`

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 4, 2025, 7:30pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/29 "2025-11-04T19:30:16Z")

</div>

> [@glv](#):
>
> I had to add an `=` sign for this to work with `sketchPath()` in `layer` in your code (`subsketch_0` in my code):
> 
> `final String[] switches = { ARGS_SKETCH_FOLDER + "=" + sketchPath(), "" };`

Indeed, that was a very old example which I had forgotten to include an `'='` character, which is required for the **runSketch()**'s `switch/case` block parser:

> <https://github.com/processing/processing4/blob/processing-1310-4.4.10/core/src/processing/core/PApplet.java#L749-L755>

> <https://github.com/processing/processing4/blob/processing-1310-4.4.10/core/src/processing/core/PApplet.java#L9960-L9969>

So this is the fixed line:  
`final String[] switches = { ARGS_SKETCH_FOLDER + '=' + sketchPath(), "" };`

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 4, 2025, 8:38pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/30 "2025-11-04T20:38:00Z")

</div>

Your output on Windows is different from a Mac; there appears to be platform differences! Does my demo run with an empty string, ie do you see the “Test Window“? Here’s what I see on Windows 11 with an empty string in the array:

 ![w11 (2)](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/c/9/c93abe9528179fb2814e5e0147a42790d9ef1616.png)

Runs on Linux(popOS) with empty string also and there is output for sketchPath() and dataPath() similar to Windows.

 ![linuxOut](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/7/5/75f3b2cab59df749fd10367d5687c4466474473a.png)

I’m curious why you would want to use the extra code when something simple works?

> [@svan](#):
>
> `PApplet.runSketch(new String[]{""},this);`

PApplet.runSketch() just wants a String array and it apparently doesn’t really care what the String is; even an empty one will work.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 4, 2025, 10:11pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/31 "2025-11-04T22:11:26Z")

</div>

> [@svan](#):
>
> Runs on Linux(popOS) with empty string also and there is output for sketchPath() and dataPath() similar to Windows.

This is the text in your image:

```auto
ARGS_SKETCH_FOLDER = --sketch-path
sketchPath = /snap/processing/10/opt/processing/lib/app/resources/core
[0] "--sketch-path/snap/processing/10/opt/processing/lib/app/resources/core"
[1] ""
dataPath = /snap/processing/10/opt/processing/lib/app/resources/core/data

```

This should have an `=` sign if used for Windows and passing the argument:

`[0] "--sketch-path=/snap/processing/10/opt/processing/lib/app/resources/core"`

> [@svan](#):
>
> PApplet.runSketch() just wants a String array and it apparently doesn’t really care what the String is; even an empty one will work.

_We do not seem to be on the same page in this discussion._

Each OS seems to have its nuances and I am getting lost in the quagmire.

> [@svan](#):
>
> I’m curious why you would want to use the extra code when something simple works?

_Curiosity is the beginning of all wisdom_ .” - Quote by Françoise Sagan.

This is the objective I have been working towards:

This code launches a new TestWindow instance and correctly passes the `ARGS_SKETCH_FOLDER` argument to ensure that `sketchPath()` and `dataPath()` resolve properly within the new PApplet.

This code achieves that objective on Windows 10 and Processing 4.4.10 :

```auto
// Main sketch
TestWindow testWindow;

void setup() {
  // The argument array MUST contain the equals sign to work:
  final String[] switches = { ARGS_SKETCH_FOLDER + "=" + sketchPath(), "" }; 
  //final String[] switches = { "" }; 
  
  println("--- Main Sketch ---");
  println("Main sketchPath:"); 
  println(sketchPath());
  println("Arguments Passed:");
  printArray(switches);
  
  // Launch the PApplet instance
  runSketch(switches, testWindow = new TestWindow());
}

void draw() {
  exit();
}

// Separate PApplet class
class TestWindow extends PApplet {
  void settings() {
    size(200, 200);
  }

  void setup() {
    background(100);
    println("\n--- TestWindow PApplet ---");
    
    // 'testWindow' (lowercase) refers to the launched instance:
    println("testWindow sketchPath: ");
    println(sketchPath()); 
    println("testWindow dataPath:"); 
    println(dataPath(""));
  }
  
  void draw() {}
}

```

I also passed a global variable in earlier examples.

This was certainly an engaging topic, and all good things must come to an end… my participation will have to end here.

@ffernandaffranco Thanks for the topic!

Have fun!

`:)`

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 4, 2025, 10:50pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/32 "2025-11-04T22:50:22Z")

</div>

I concede that _`{ ARGS_SKETCH_FOLDER + “=” + sketchPath(), “” };`_ is necessary to pass sketchPath() from a Processing app to the PApplet; it also allows loadImage(“myImg.png“) to work correctly on a Mac after doing that. What I can’t figure out is how the dataPath(““) got passed.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 5, 2025, 11:47am UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/33 "2025-11-05T11:47:55Z")

</div>

> [@svan](#):
>
> What I can’t figure out is how the **dataPath(““)** got passed.

Functions [**dataPath()**](https://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#dataPath-java.lang.String-) & **[dataFile()](https://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#dataFile-java.lang.String-)** rely on field _sketchPath_ + “data”:

> <https://github.com/processing/processing4/blob/processing-1310-4.4.10/core/src/processing/core/PApplet.java#L180-L185>

> <https://github.com/processing/processing4/blob/processing-1310-4.4.10/core/src/processing/core/PApplet.java#L7345-L7346>

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 5, 2025, 2:45pm UTC](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472/34 "2025-11-05T14:45:45Z")

</div>

Thanks. I finally figured that out; once you’ve got sketchPath() it’s pretty easy to tack on ‘/data‘. This thread has been instructive in a number of ways: 1) There are differences in the platforms 2) At least on a Mac, PApplet doesn’t know its _sketchPath()/dataPath()_ 3) There is a way to pass sketchPath() in from a base Processing app or alternatively use the full path to the data folder for a call such as _loadImage()_ which depends on it.

[Previous page](https://discourse.processing.org/t/processing-can-find-the-data-folder-in-windows-11-but-not-in-linux-or-mac/47472.md?page=1)
