I know this question is very basic, but it was already asked and it doesn't have a very complete answer, actually it's just a comment:
How to make a Processing Sketch with external libraries and files work on a website?
So, i know this doesn't work on PHP servers, but what if I have a java hosting? Would it work then?
Please understand the difference between something running on a server and something running on a client. The question you linked to isn't asking about a server at all. It's asking about running a Processing sketch in a browser, not on a server.
What kind of server you're using doesn't matter if you're just trying to run stuff in the browser. You just need a basic file server, and there are many free options. I personally like GitHub Pages.
You'll need to use Processing.js or P5.js to deploy your Processing sketch to a webpage. I wrote a guide on the differences between these Processing versions here.
If you are really asking about how to run Processing on a server and not in a browser, then see this page: https://github.com/processing/processing/wiki/Running-without-a-Display