Using loadStrings() to load a text file from a relative URL in a Procesing applet
in
Integration and Hardware
•
1 year ago
I am writing a Processing sketch that will run as an applet.
How do I use the loadStrings() method to load a file from an URL relative to the applet folder (i.e. a file "example.txt" contained in the applet folder)?
Note that
loadStrings("example.txt") will only work to read the file from the sketch folder when run locally/as a standalone application. When the applet is run, the "example.txt" will refer to a file somewhere on the local machine, not on the server. Additionally, loadStrings cannot take a Java URL class (and, besides, I want to avoid using classes not present in Processing spec so that I could have a project that works in ProcessingJS as well).
Thanks!
1