leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
434 stars 21 forks source link

What is the correct file structure to load local files that are not packaged within *.jar? #159

Closed apolinario closed 1 year ago

apolinario commented 1 year ago

My application contains code that requires loading an external file (a file that is not packaged into the *.jar). In Java, I can just use a relative path and run the java -jar myfile.jar and make sure the relative path is findable in the same folder where the command is ran

However if I try the same with cheerpj, it cannot find the file if they are on the same hierarchy level as the demo.html

What is the correct way for the application to find external files? (modifying the code is possible in case the path has to be amended on the application side)

alexp-sssup commented 1 year ago

CheerpJ supports a virtual file system, please see the docs here: https://docs.leaningtech.com/cheerpj/File-System-support

The "current working directory" points to /files/, which is an IndexedDB based writable filesystem. If you need to access resources over HTTP you need to use the /app/ filesystem.

For further support I recommend joining our discord here: https://discord.leaningtech.com