Hello Snapcraft community: im trying to create a snap which runs a java application. The snap creation works, but unfortunately i cant launch the application. Im very new into snaps, so help would be much appreciated
Here is my Snapcraft.yaml file:
name: java-app # base: core18 version: ‘2021.1’ summary: java test app description: this is a java app grade: devel confinement: devmode
parts: java-app: plugin: nil source: ./ override-build: mv $SNAPCRAFT_PART_INSTALL/usr/lib/jvm/java-11-openjdk-* $SNAPCRAFT_PART_INSTALL/usr/lib/jvm/java-11-openjdk stage-packages: - openjdk-11-jre - ca-certificates - ca-certificates-java
apps:
java-app: command: /project/src/bin/run.sh environment: JAVA_HOME: $SNAP/usr/bin/jvm/java-11-openjdk PATH: $JAVA_HOME/jre/bin:$PATH
Output when generating snap:
Staging java-app snapcraftctl stage Priming java-app snapcraftctl prime … A shell wrapper will be generated for command ‘/src/bin/run.sh’ as it does not conform with the command pattern expected by the runtime Commands must be relative to the prime directory and can only consist of alphanumeric characters, spaces, and the following special characters: / . _ # : $ - Snapping |
Snapped java-app_2021.1_amd64.snap
Output after installing snap and then launching java app:
java-app /snap/java-appe/x1/command-java-app.wrapper: 2: exec: /project/src/bin/run.sh: not found
Im not sure how to expose the java-app appropriately.
More Information: Im on a Mac and running a VM with Multipass. For testing of the snap i mount the directory to a fresh VM The Java application itself is on my mac desktop and unzipped.