Snapcraft PLUGIN -- jdk (Java runtime) ---> app Error

No. It is not there.

i think you need an additional organize entry in the buga-stock part in your snapcraft yaml to actually copy the jar in place …

take a look in parts/buga-stock/build and parts/buga-stock/install in your build tree where the files actually end up and adjust snapcraft.yaml accordigly …

I have the jar file aswell. Can u please tell me how I can proceed without using any zip source?

I didn’t get what need to be done here.

there is a million ways to achieve that … you could try putting the jar in the toplevel of your tree and change your part like:

buga-stock:
  source: .
  plugin: dump
  organize:
    buga-stock.jar: buga-stock.jar
  stage-packages: [openjdk-8-jre]

the dump plugin is described at:

you could also use the nil plugin and use an install scriptlet with a cp command (i’ll leave it to you to find the info in the snapcraft docs for that one :slight_smile: )

Thankyou :slightly_smiling_face: I will try doing this.

@ogra have a doubt using the scriplet install. Can u tell me how to use it. I have never used the scriplet building the snapp. What paths I need to mention and how it will get copied to its destination?

what what all changes do I need to do in launcher.sh

#!/bin/bash

if [ "$SNAP_ARCH" = "amd64" ]; then
  ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" = "armhf" ]; then
  ARCH="arm-linux-gnueabihf"
else
  ARCH="$SNAP_ARCH-linux-gnu"
fi

export JAVA_HOME=$SNAP/usr/lib/jvm/java-8-openjdk-$SNAP_ARCH
export PATH=$JAVA_HOME/jre/bin:$PATH

# Not good, needed for fontconfig
export XDG_DATA_HOME=$SNAP/usr/share
# Font Config
export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf



java -jar -Duser.home=$SNAP_USER_DATA $SNAP/buga-stock.jar

take a look at the bottom of:

… and the launcher looks ok to me … (you need to make sure it is executable indeed)

Yes. it is executable…
where do i need to copy the jar file ?

wheerver you want to use it from … on the running system the $SNAPCRAFT_PART_INSTALL/ variable is $SNAP/ …