The file is missing or Inaccessible

@RecursiveCursive Even if getClass().getResource(...) returns the full path, loadImage() handles only certain cases. First thing is to understand the implementation of loadImage(). If you want to inspect this closer, you can have a look at the source code:

processing/core/src/processing/core/PApplet.java at master · processing/processing · GitHub

processing/core/src/processing/core/PApplet.java at master · processing/processing · GitHub

The first link takes you to the definition of loadImage: In certain cases, it loads the image with pre-defined methods based on the extension. For png/jpg/unknow extensions, it tries first to infer if the image is an url and loads it. Otherwise, it loads the byte stream directly, throwing an error if something goes wrong. But there is no implementation to handle jar files.

In other words, it doesn’t knows how to retrieve data from resource jar files. My suggestion is this. You can try loading the image first using this post and then use the second above to bring it to Processing.

I would like to add that your post is not related to the initial OP statement. You should consider creating a new post next time so the OP does not receive messages that are not related to its initial question.

Kf

1 Like