JAVAFX App: personal-files interface doesn't give access to $HOME/.openjfx cache directory in Strict mode

backticks: ```

add a block of three like:

```
my pasted log output, snapcraft.yaml, config file or code
```

else your paste gets interpreted as markdown by the forum software and you end up with random formatting blocks which make the pasted code completely unreadable …

OK! I’ll try and edit the post!

cheers
Alan

Ogra,
Does that work? It does seem better to me!

cheers
Alan

1 Like

yes, a lot better :slight_smile:

1 Like

what does:

snap connections photonotebook

show … did you connect the openjfx interface yet (it will definitely not auto-connect by default) ?

Yes:

snap connections shows:

personal-files photonotebook:openjfx :personal-files manual

//==============

well, the personal files interface only grants read (mask=“r”) and write (mask=“w”) access … your app is trying to memory map the lib (mask=“m”), i suspect that wont work.

what you could do is to copy (which only requires read access) the dir content to $SNAP_USER_DATA (/home/alan/snap/photonotebook/current/) with a command-chain script and use it from there …

hmmmm… assuming I could do that, I’m not sure how I persuade the java components to access the copied library rather than the default … I can’t get my head around is why the java components are using the users $HOME rather than the snap $HOME …

Alan

perhaps because java doesnt read $HOME but does pull it from a getent() of the passwd file ?

possibly, but there is nothing I can do to alter the javafx library files. That’s with the OpenJFX project.
is Classic not a realistic option?

I wonder which is the worse security risk - allowing a memory map of the personal file, or going classic for the whole app?

well, on any “normal” java app that you start via a java /path/to/jar call you can do something like:

java -Duser.home=/home/user/snap/snapname/current /path/to/jar

not sure how you’d do this with something like photonotebook … but i’d be surprised if there is not some kind of setting to set a search path for openjfx

I’m not sure it’s using a search path to find the .openjfx cache, and I’ve been through the JAVAFX documentation trying to find if the .openjfx can be relocated … no luck … I’ll have a go with the -D= option as you suggest and see if it works!

cheers
Alan

I used the -D option as you suggested

"$DIR/java" -Duser.home=/home/user/snap/photonotebook/current  -p "$DIR/../app" -m PhotoNoteBook/com.dryjointproductions.photonotebook.PhotoNoteBook  "$@"

prior to launching java the following are set

$DIR = /snap/photonotebook/x1/bin
$HOME = /home/alan/snap/photonotebook/x1

startup crash has changed:

Loading library prism_es2 from resource failed: java.io.IOException: Can not create cache at /home/user/snap/photonotebook/current/.openjfx/cache/11.0.2

SNAP_CONFINE_DEBUG=1 snap run photonotebook

DEBUG: umask reset, old umask was  022
DEBUG: security tag: snap.photonotebook.photonotebook
DEBUG: executable:   /usr/lib/snapd/snap-exec
DEBUG: confinement:  non-classic
DEBUG: base snap:    core18
DEBUG: ruid: 1000, euid: 0, suid: 0
DEBUG: rgid: 1000, egid: 1000, sgid: 1000
DEBUG: apparmor label on snap-confine is: /snap/core/9436/usr/lib/snapd/snap-confine
DEBUG: apparmor mode is: enforce
DEBUG: creating lock directory /run/snapd/lock (if missing)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock directory /run/snapd/lock
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: opening lock file: /run/snapd/lock/.lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: acquiring exclusive lock (scope (global), uid 0)
DEBUG: sanity timeout reset and disabled
DEBUG: ensuring that snap mount directory is shared
DEBUG: unsharing snap namespace directory
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: releasing lock 5
DEBUG: opened snap-update-ns executable as file descriptor 5
DEBUG: opened snap-discard-ns executable as file descriptor 6
DEBUG: creating lock directory /run/snapd/lock (if missing)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock directory /run/snapd/lock
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: opening lock file: /run/snapd/lock/photonotebook.lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: acquiring exclusive lock (scope photonotebook, uid 0)
DEBUG: sanity timeout reset and disabled
DEBUG: initializing mount namespace: photonotebook
DEBUG: snappy_udev_init
DEBUG: setup_devices_cgroup
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: write_string_to_file /sys/fs/cgroup/devices/snap.photonotebook.photonotebook/cgroup.procs 25814
DEBUG: write_string_to_file /sys/fs/cgroup/devices/snap.photonotebook.photonotebook/devices.deny a
DEBUG: run_snappy_app_dev_add: /sys/class/mem/null snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/mem/null 1:3
DEBUG: run_snappy_app_dev_add: /sys/class/mem/full snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/mem/full 1:7
DEBUG: run_snappy_app_dev_add: /sys/class/mem/zero snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/mem/zero 1:5
DEBUG: run_snappy_app_dev_add: /sys/class/mem/random snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/mem/random 1:8
DEBUG: run_snappy_app_dev_add: /sys/class/mem/urandom snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/mem/urandom 1:9
DEBUG: run_snappy_app_dev_add: /sys/class/tty/tty snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/tty/tty 5:0
DEBUG: run_snappy_app_dev_add: /sys/class/tty/console snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/tty/console 5:1
DEBUG: run_snappy_app_dev_add: /sys/class/tty/ptmx snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/class/tty/ptmx 5:2
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 136:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 137:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 138:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 139:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 140:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 141:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 142:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/pts/slaves 143:*
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/nvidia0 195:0
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/nvidiactl 195:255
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/nvidia-uvm 239:0
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/nvidia-modeset 195:254
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/uhid 10:239
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /dev/net/tun 10:200
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:01.1/0000:07:00.0/drm/card1 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:01.1/0000:07:00.0/drm/card1 226:1
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:01.1/0000:07:00.0/drm/renderD129 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:01.1/0000:07:00.0/drm/renderD129 226:129
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:02.0/drm/card0 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:02.0/drm/card0 226:0
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1 0:0
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1 0:0
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 226:128
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sr0 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sr0 11:0
DEBUG: run_snappy_app_dev_add: /sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/scsi_generic/sg1 snap_photonotebook_photonotebook
DEBUG: running snap-device-helper add snap_photonotebook_photonotebook /sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/scsi_generic/sg1 21:1
DEBUG: forked support process 25863
DEBUG: changing apparmor hat to mount-namespace-capture-helper
DEBUG: helper process waiting for command
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: block device of snap core18, revision 1754 is 7:47
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: joining preserved mount namespace for inspection
DEBUG: block device of the root filesystem is 7:47
DEBUG: sanity timeout reset and disabled
DEBUG: preserved mount is not stale, reusing
DEBUG: joined preserved mount namespace photonotebook
DEBUG: joining preserved per-user mount namespace
DEBUG: unsharing the mount namespace (per-user)
DEBUG: sc_setup_user_mounts: photonotebook
DEBUG: performing operation: (disabled) use debug build to see details
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: calling snapd tool snap-update-ns
DEBUG: waiting for snapd tool snap-update-ns to terminate
DEBUG: requesting changing of apparmor profile on next exec to snap-update-ns.photonotebook
change.go:316: DEBUG: mount name:"/run/user/1000/doc/by-app/snap.photonotebook" dir:"/run/user/1000/doc" type:"none" opts:MS_BIND unparsed:"" (error: <nil>)
DEBUG: snap-update-ns finished successfully
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: NOT preserving per-user mount namespace
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: moved process 25814 to cgroup hierarchy /sys/fs/cgroup/freezer/snap.photonotebook
DEBUG: releasing lock 7
DEBUG: sending command 0 to helper process (pid: 25863)
DEBUG: waiting for response from helper
DEBUG: sanity timeout reset and disabled
DEBUG: helper process received command 0
DEBUG: helper process exiting
DEBUG: waiting for the helper process to exit
DEBUG: helper process exited normally
DEBUG: resetting PATH to values in sync with core snap
DEBUG: set_effective_identity uid:1000 (change: yes), gid:1000 (change: yes)
DEBUG: creating user data directory: /home/alan/snap/photonotebook/x1
DEBUG: requesting changing of apparmor profile on next exec to snap.photonotebook.photonotebook
DEBUG: ruid: 1000, euid: 1000, suid: 0
DEBUG: setting capabilities bounding set
DEBUG: regaining SYS_ADMIN
DEBUG: loading bpf program for security tag snap.photonotebook.photonotebook
DEBUG: read 6944 bytes from /var/lib/snapd/seccomp/bpf//snap.photonotebook.photonotebook.bin
DEBUG: read 152 bytes from /var/lib/snapd/seccomp/bpf/global.bin
DEBUG: clearing SYS_ADMIN
DEBUG: execv(/usr/lib/snapd/snap-exec, /usr/lib/snapd/snap-exec...)
DEBUG:  argv[1] = photonotebook
DEBUG: umask restored to  022
DEBUG: working directory restored to /home/alan/IdeaProjects/PhotoNoteBook-V1/snapLinux
/snap/photonotebook/x1/bin
HOME: /home/alan/snap/photonotebook/x1
Loading library prism_es2 from resource failed: java.io.IOException: Can not create cache at /home/user/snap/photonotebook/current/.openjfx/cache/11.0.2
java.io.IOException: Can not create cache at /home/user/snap/photonotebook/current/.openjfx/cache/11.0.2
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.cacheLibrary(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(Unknown Source)
	at javafx.graphics/com.sun.prism.es2.ES2Pipeline.lambda$static$0(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.prism.es2.ES2Pipeline.<clinit>(Unknown Source)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Unknown Source)
	at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Loading library prism_sw from resource failed: java.io.IOException: Can not create cache at /home/user/snap/photonotebook/current/.openjfx/cache/11.0.2
java.io.IOException: Can not create cache at /home/user/snap/photonotebook/current/.openjfx/cache/11.0.2
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.cacheLibrary(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(Unknown Source)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(Unknown Source)
	at javafx.graphics/com.sun.prism.sw.SWPipeline.lambda$static$0(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.prism.sw.SWPipeline.<clinit>(Unknown Source)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Unknown Source)
	at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: No toolkit found
	at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
	... 5 more

journalctl -e --no-pager | grep DENIED

Jul 06 15:00:43 Dalek audit[26037]: AVC apparmor="DENIED" operation="open" profile="snap.photonotebook.photonotebook" name="/proc/26037/mountinfo" pid=26037 comm="java" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek kernel: audit: type=1400 audit(1594044043.447:4057): apparmor="DENIED" operation="open" profile="snap.photonotebook.photonotebook" name="/proc/26037/mountinfo" pid=26037 comm="java" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek audit[26037]: AVC apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek audit[26037]: AVC apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek kernel: audit: type=1400 audit(1594044043.691:4058): apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek kernel: audit: type=1400 audit(1594044043.691:4059): apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek audit[26037]: AVC apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek audit[26037]: AVC apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek kernel: audit: type=1400 audit(1594044043.699:4060): apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
Jul 06 15:00:43 Dalek kernel: audit: type=1400 audit(1594044043.699:4061): apparmor="DENIED" operation="mkdir" profile="snap.photonotebook.photonotebook" name="/home/user/" pid=26037 comm="QuantumRenderer" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000

snapcraft.yaml:

title: PhotoNoteBook
version: '1'
summary: The digital photography library manager and notebook 
license: Proprietary
description: PhotoNoteBook is a digital photograph library manager enabling collections of images and the making of notes and memo's for the collections and the photographs. 
icon: photonotebook.png 
confinement: strict
grade: stable
base: core18

plugs:
  openjfx:
    interface:  personal-files
    write: [ $HOME/.openjfx ]
      
apps:
  photonotebook:
    extensions:
      - gnome-3-28
    plugs: [desktop, desktop-legacy, wayland, unity7, unity8, x11, opengl, removable-media, optical-drive, home, openjfx]
    command: bin/photonotebook


parts:
  photonotebook:
    plugin: dump
    source: ./photonotebook/
    stage-packages: [libfreetype6, libpng16-16, libx11-6, libxext6, libxi6, libxrender1, libxtst6, libasound2 ]

I tried “common” as well

Loading library prism_es2 from resource failed: java.io.IOException: Can not create cache at /home/user/snap/photonotebook/common/.openjfx/cache/11.0.2
java.io.IOException: Can not create cache at /home/user/snap/photonotebook/common/.openjfx/cache/11.0.2

the rest is pretty similar …

try using

-Duser.home=$SNAP_USER_DATA

(i guess your system does not actually have an account called “user” :slight_smile: )

1 Like

Convincing the application to properly use ~/snap/your-snap/current is the right approach. It would be possible for you to work around this with personal-files by having /home/alan/.openjfx/cache be a symlink to ~/snap/your-snap/current/.openjfx/cache (or similar) and this would ‘work’, but the problem is that your snap is not the owner of $HOME/.openjfx and so our processes would not allow this interface to be auto-connected (or perhaps even used) since this access would allow sandbox escape via writing a .so file that an unconfined javafx application could pickup.

1 Like

DOH! I deserve a slap on the wrist for that one! :wink:

correcting the -D option for a real path, and for $SNAP_USER_DATA allows the app to start, and I can import photographs from my own directory on my local disk.

However a new problem is that I cannot see mapped drives or usb devices on the file manager … so cannot import / export photos …

make sure the removable-media interface is connected, that gives you access to /media (where all usb devices get auto-mounted by default) and /mnt (for admin-mounted/fstab-mounted drives) …

Hi,
yes that does work … but the result is not exactly User friendly … the usb stick doesn’t appear in “Files” as a mounted drive, and the network drives don’t appear as " Other Locations" in the file manager …if the User doesn’t know where to find /media and isn’t tech-savvy enough to realise that “/media/user/2B9D-7B8D” is the identifier of the san disk memory device they just plugged in, they is going to find using the app frustrating …(I am expecting the users to be photographers) …

Any offers?

I also find my app data wiped on every fresh install, should I be using SNAP_USER_COMMON rather than SNAP_USER_DATA?

Thanks for your help today, after a frustrating few days its great to make some progress!

do you expect users to install more than once ? typically a user installs once and then gets upgrades …

indeed if you do “snap remove” before doing “snap install” that will remove the data (though snapd takes a snapshot by default before removing a package which you can restore with the “snap restore” command … )

1 Like

yeah … I realised the mistake about 10 minutes after I went out for a walk … doh!

At the moment, the inability to present a unified view of mounted file systems through the JavaFX FileChooser.showOpenMultipleDialog(new Stage()) and DirectoryChooser.showdialog(new Stage()) calls may be a showstopper.

I need to think some more, and perhaps ask a new question.
Thanks again!