Despite the documentation saying it can only use tar-balls as source, the zip files is being decompressed fine and the folder within it is then moved to the folder lt which is present in both stage and prime.
Failed to generate snap metadata: The specified command ‘$JAVA_HOME/jre/bin/java -cp $SNAP/lt/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081’ defined in the app {‘environment’: {‘PATH’: ‘$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH’, ‘JAVA_HOME’: ‘$SNAP/usr/lib/jvm/java-1.8.0-openjdk-$SNAP_ARCH’}, ‘command’: ‘$JAVA_HOME/jre/bin/java -cp $SNAP/lt/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081’, ‘plugs’: [‘network’, ‘network-bind’]} does not exist.
Ensure that ‘$JAVA_HOME/jre/bin/java -cp $SNAP/lt/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081’ is installed with the correct path.
I tried running snapcraft with snapcraft --use-lxd --debug which let me enter the container, but apparently without the environment variables set, so I cannot check whether $SNAP is what it should be, etc. . Instead of openjdk-8-jdk I also tried with openjdk-11-jre-headless and it gave me the same result. There seems to be little or no information about how to run a java app or how to debug any of this in the snapcraft documentation so it’s very much trial and error it feels like. The full snap recipe can be found here.
since you are adding $JAVA_HOME/jre/bin to your PATH already you should not define the full path in the command … just trim it down to a simple java -cp $SNAP/lt/...
I suspected that I should be looking in prime/user/lib/jvm/...but the jvm folder doesn’t exist. Maybe the jdk or jre packages are not installed for some reason?
@ogra This seems to work, but it’s installing a lot of stuff I don’t really need as I don’t use gradle. Using the gradle plugin gave me the jre at runtime and that has so far been the only way I have been able to run a java program:
I actually looked at that package first and even though I thought I had done the exact, it just didn’t work, it’s very hard to debug what is actually going on and there seems to be no real documentation.
Maybe this stopped working with core18 at some point and noone noticed?
Now that the fidusewriter snap is somehow magically working, I’m reluctant to fiddle more with it.
Hopefully snapcraft gets a little better at all this so others don’t have to spend as much time on something that should be trivial.