Set java env with _JAVA_OPTIONS


#1

Hi. I updated the snap for jabref (bibliographical reference manager).
It’s a java program built with gradle.
It builds and runs properly in devmode.
If I run with strict confinement it can’t read the java.utils.prefs paths (for system and user preferences), and the jvm locks up.

I tried to override the paths with JAVA_OPTS, but it makes no difference. The program still looks for the files in my home folder.

Is there something else I should do with a java build?
The yaml is here: https://github.com/JabRef/jabref/blob/b3f35ec19a2f9383feab1b3faf97109214bdc780/snap/snapcraft.yaml


#2

If I remove the folder .java in my home directory it works, but with the following warnings/errors

Jan 26, 2019 9:29:34 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: Couldn't create user preferences directory. User preferences are unusable.
Jan 26, 2019 9:29:34 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: java.io.IOException: No such file or directory
21:29:34.681 [JavaFX Application Thread] INFO  org.jabref.migrations.PreferencesMigrations - Migrating old custom entry types.
Jan 26, 2019 9:29:36 PM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock User prefs.  Unix error code 2.
21:29:36.248 [JavaFX Application Thread] INFO  org.jabref.preferences.JabRefPreferences - Updating stored custom entry types failed.
java.util.prefs.BackingStoreException: Couldn't get file lock.

It seems like the jre can escape the snap strict confinement… and it ignores the JVM_OPTS


#3

Solved using _JAVA_OPTIONS instead of JAVA_OPTS