Loading files from outside the `data` folder

Can one load files from outside the data folder of a sketch using functions like loadImage()? Apparently Java paths can look like:

../../../../C:/Users/Brahvim/Projects/Photo Edits/Outputs/image.png,
…but it doesn’t seem to work with loadImage(), at least.

Should I be using java.net.URLs for this instead?

As an extra topic, …how about loading them from a JAR?!


Sorry for faulty research on my part. The following worked!:

void setup() {
  size(500, 500);
  image(loadImage("C:/Projects/Photo Edits/PFP_DoNotEDIT_DoNotDELETE.jpg"), 0, 0);

Immediate edit: It seems that PApplet.loadJSONObject() takes in a java.io.File, which is great, too!

The non-static version (PApplet::loadJSONObject(String)) assumes that our data would be in the sketch’s execution directory.

Right away, I also noticed that PApplet::loadXML(String) works with absolute paths. Yay!