Hello, I’m trying to embed a Processing sketch onto an HTML page, which uses Java libraries, I’ve been following this guide.
Processing on the web does not support imported libraries, which is probably why the program works perfectly on the IDE but not on my webpage. How do I manually add these libraries to my code? Can I just download them and put them in folders somehow?
This is the part of my code that needs to be replaced:
You can’t do it that way on client-side js. The libraries are for java not for Javascript which processingJS is build for.
Further, ProcessingJS is outdated, therefore you should use p5js.
You should adapt the java code to Javascript code. Not all thing from java are possible in js but most.
If you provide the java code, resp. processing java sketch you want to convert to js, we could try to help you …
Hi @mnse and thank you for your answer.
So if I convert my Processing code to p5.js I would have to convert the java libraries I wanted to import too? Is there no way to import java libraries into a p5.js program?
Thank you
P5js and processing java build up a similar framework ie. setup/draw.
Regarding the libraries. No! Java and Javascript are different things.
But if you want to implement backend logic with java you can use a server-site approach ie. RestAPI calls etc.
But that mean you need an appserver running ie. tomcat.
As said, all depends on your code and what it does … and if you could tell what libraries you want to use for what we can see if there are similar libraries for js…