[snapcraft - parts] “… If you only need to embed a Java runtime, add a part with the jdk type. This will pull a relocatable OpenJDK via the default-jdk Ubuntu package and will set the proper JAVA_HOME and PATH environment variables in wrapper scripts generated by Snapcraft or when running the app locally.”
What is the difference between the ‘snapped’ java runtime (jre) and the installed jre?
While my app is running with the installed jre it won’t work with the ‘snapped’ one…
After hours and hours without any solution I decided to take two easy examples from the www —
and …? These converted to ‘jdk-snaps’ did NOT work either (same problem).
You can try it yourself: test.tar.gz
Start test1/test2* with Java installed. Then craft a snap** (test) and try that one.
(*) works fine. Right?
(**) does not work. Right again?
i have a snapped java GUI app at https://github.com/ogra1/jtiledownloader perhaps that gives you some ideas (i would do it differently nowadays and it might be that there is also a java-desktop part the could replace the wrapper script by now)
I wouldnt use a Makefile but snapcraft scriptlets and would check if there is an existing desktop wrapper that provides the environment the current wrapper script sets up …
The resulting snap would be similar though, it is really up to you how you perfer to buld it in the end. The Makefile setup is definitely fine too, i just dont do it like that personally anymore because it appears cleaner to have everything in snapcraft.yaml if possible.
After all the important bits are to have openjdk-8-jdk in stage-packages and to have the JAVA_HOME and PATH variables set like in the wrapper … since i created the original snap snapcraft grew a lot additional support (like the environment keyword so you wouldnt need a wrapper) to put things directly into snapcraft.yaml
After installing the snap. the openjdk package is not installed in my local machine. i had mentioned it in stage-package.
please help me with this. @ogra I tried using your snap. Still after installing jtiledownloader , the openjdk package is not installed. Can u help me with this?
What is your host OS ?
(typically the snap installs a jtiledownloader link in /snap/bin, some distros do not set this in their PATH variable, so you would have to either call /snap/bin/jtiledownloader directly or calll “snap run jtiledownloader”)
can you please format your .yaml pastes as code (either mark it in the input editor and click the </> button, or wrap it with three backticks ```at the start and end of the paste ) else this is unreadable …