Trying to get CheerpJ to actually launch a program

I'm trying to get CheerpJ to run UPRandomizer in a browser, but I can't figure out how to get it to start. It always gives the error "Error: Could not find or load main class com.dabomstew.pkrandom.gui.RandomizerGUI" Can anyone help me with this?
22 Replies
apignotti
apignotti16mo ago
Most likely the classpath used for the cheerpjRunMain API call is not correct. I would recommend to follow the Tutorial once to get a better understanding of the tool: https://labs.leaningtech.com/cheerpj2/getting-started/Tutorial
Installation
Run C/C++, Java, and native code in the browser with our WebAssembly developer tools and JavaScript libraries: Cheerp, CheerpJ, and CheerpX
0xBann
0xBannOP16mo ago
That's uh That's what I did
apignotti
apignotti16mo ago
Does the tutorial application work for you?
0xBann
0xBannOP16mo ago
Nope
apignotti
apignotti16mo ago
Then there must be some obvious mistake in the page integration. Do you get any error on the dev tools console? I am referring to the tutorial application right now, it's quite likely that by debugging that we can understand what the problem is in your own app
0xBann
0xBannOP16mo ago
wait so just using the tutorial html will result in a separate app being run? I'm might stupid
apignotti
apignotti16mo ago
The tutorial HTML is intended to run the specific JAR file referenced in the tutorial itself. This happens via the cheerpjRunJar API Please try the whole tutorial from start to finish, so that you can get a better understanding of the tool. If your application is normally started via java -jar <name>.jar then the cheerpjRunJar API is the correct one If, on the other hand, the app is normally started via java -cp <jar1.jar>:<jar2.jar> name.of.main.Class, you need to use the cheerpjRunMain API But the rest of the HTML stays the same
0xBann
0xBannOP16mo ago
I'm gonna work on this tomorrow okay I got it to work Though now I need to figure out how to have it save files to my computer if possible
apignotti
apignotti16mo ago
You will need to write some integration manually in JavaScript, the browsers are very limited in the access they provide for the filesystem so CheerpJ works with a completely virtualized file system
apignotti
apignotti16mo ago
For more info about filesystems please see: https://labs.leaningtech.com/cheerpj2/guides/File-System-support
File System support
Run C/C++, Java, and native code in the browser with our WebAssembly developer tools and JavaScript libraries: Cheerp, CheerpJ, and CheerpX
apignotti
apignotti16mo ago
You will need to save the file on the read-write /files/ mount point
0xBann
0xBannOP16mo ago
It already is able to save to /files/ I just don't know how to get it from there onto my computer
apignotti
apignotti16mo ago
You can get a Blob object using the cjFileBlob API, for example cjFileBlob("/files/file1.txt") It returns a promise that resolve to a Blob you can then download it using standard JS techniques
0xBann
0xBannOP16mo ago
I'm sure that's helpful, though I don't know nearly any JS I do appreciate it
apignotti
apignotti16mo ago
Stack Overflow
Save to Local File from Blob
I have a difficult question to you, which i'm struggling on for some time now. I'm looking for a solution, where i can save a file to the users computer, without the local storage, because local st...
apignotti
apignotti16mo ago
Being a standard technique you might be able to even find examples more similar to what you want to achieve precisely. The keywords are "Blob" and "download" in the context of JavaScript, of course
0xBann
0xBannOP16mo ago
👍 Thanks, man
apignotti
apignotti16mo ago
I am marking this thread as resolved, for further general questions consider using the #cheerpj2 channel
0xBann
0xBannOP16mo ago
okiecoke
apignotti
apignotti16mo ago
One last thing, could you elaborate what part of the tutorial was not clear in the beginning? We are in the process or revisiting the docs and your input might be useful in that regard
0xBann
0xBannOP16mo ago
I was skimming through it while very tired, so I couldn't tell you
apignotti
apignotti16mo ago
Ok, thanks for your feedback nonetheless. Take care.
Want results from more Discord servers?
Add your server