I have never imported a library in my life before.
Google says compile it including it to the classpath.
So how do include external java code that I want to use in my sketch but isnt in the sketch’s directory?
And what format does it have to be in?
plain directory, jar?
probably compiled code (.class) ?
How do I reference a library WITHOUT having to COPY it to the SKETCH DIRECTORY?
If the library is one specifically for processing then just go to sketch>import library…>add library… in the Processing IDE.
If it’s a external java library check out Dan Shiffman’s coding challenge where he uses OpenSimplex.java in the challenge. If I remember right you can add a .java file your sketch. I haven’t used the Processing IDE in a while so I’m not entirely sure on this one.
If you’re using processing in eclipse you import the .jar and add it to the build path. You can also check out Dan’s latest live stream (around time code 1:08:30) where he started working on porting a java library to processing. The procedure in eclipse is the exact same as when he imports core.jar.
1 Like
We can drag & drop “.java” & “.jar” files into the PDE.
1 Like
I guess I meant it rather like that it doesn’t copy the files everytime but just silently knows the path to where to look namespaces up.
There’s no clear way to specify an arbitrary path where the PDE (Processing’s IDE) can find libraries AFAIK.
It’s either inside our sketch’s folder or inside sketchbook’s libraries folder.
The wiki below teaches how to manually install libraries for the PDE though:
3 Likes
I guess that works too, since most of my projects are using processing rn anyway
Can I just copy my libraries into the library folder?
Which format do they have to be in:
.jar, .class or.java?