Integrated Jar


This is my present Yaml:

my program is in a jar which contains all dependecies so I have commented out all references to java in my Yaml.

My just contains:


java -jar $SNAP/highlighterpdf.jar

It all installs but when I go to run it is gives:

/snap/highlighterpdf/x1/ 6: /snap/highlighterpdf/x1/ java: not found

how do I reference java inside the highlighterpdf.jar file?

Footnote for the above:

When I look inside the jar it does not seem to have java present would java show up in the archive manager?

JAR files do not include the JAVA runtime. You will need to supply that yourself, probably through adding it as a stage-packages: entry. Try default-jre or default-jre-headless. Note that the usr/bin/java symlink won’t be created automatically so you either need to call the correct binary in usr/lib/jvm/... directly, or add an override-build: scriptlet to create the required symlink. You’ll probably also want to ensure you export the environment variable JAVA_HOME with the path to the java installation.