Builds my snap ok but when I go to run it I get “Java not found” with the following Snapcraft Yaml.
name: highlighterpdf
title: HighlighterPdf
version: 1.0.2
summary: Highiight the text in a Pdf.
description:
HighlighterPdf is a free and open source software application that you can use to
highlight text in your pdf document. You can select text in a colour of your choice
and then save it.
base: core18
confinement: devmode
apps:
highlighterpdf:
extensions:
- gnome-3-28
command: desktop-launch ./highlighterpdf.sh
environment:
JAVA_HOME: $SNAP/usr/lib/jvm/java-1.8.0-openjdk
PATH: $JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
plugs:
-home
-network
-cups-control
parts:
highlighterpdf:
source: https://github.com/gerry136/highligherpdf.git
plugin: dump
build-packages:
- unzip
- openjdk-11-jdk
you’re staging openjdk 11, so the path to java is:
$SNAP/usr/lib/jvm/java-11-openjdk-amd64/bin/java
You likely want to adjust your JAVA_HOME and PATH variables accordingly:
apps:
highlighterpdf:
...
environment:
JAVA_HOME: $SNAP/usr/lib/jvm/java-11-openjdk-amd64
PATH: $JAVA_HOME/bin:$PATH # there is no ./jre folder
You will also want to fix your yaml formatting errors. Your plugs block is indented too far and the individual plugs in the list should have a space after the “list item” indicator (i.e. the hyphen “-” character).
Also, when using the gnome extension you do not need to specify desktop-launch on your app’s command setting:
apps:
highlighterpdf:
extensions: [gnome-3-28]
command: highlighterpdf.sh # make sure to include any relative paths
If your shell script is in bin then you’ll want to modify the command to bin/highlighterpdf.sh.
I made the changes you advised to do now I have more problems.
When I do not use desktop-launch in my command I get:
“The specified command ‘highlighterpdf.sh’ defined in the app ‘highlighterpdf’ is not executable.”
But I have set the permissions of highlighterpdf.sh to executable.
And when I set the plugs back to where they should be I get:
“The ‘apps/highlighterpdf/environment/plugs’ property does not match the required schema: [‘home’, ‘network’, ‘cups-control’] is not of type ‘number’ or [‘home’, ‘network’, ‘cups-control’] is not of type ‘string’”