javaflatpakflatpak-builder

Create a flatpak for a self updating java application


I want to isolate a java application in a flatpak environment it mostly works when installing the application in the /app directory.

Problem is, the application is using install4j and it is trying to self-update, but /app is read-only at runtime (when executing flatpak run ...).

Is there a way to make /app read-write, or is there another directory where I could install the application?

I think a --filesystem=xdg-something in finish-args is the start of the answer but the directory isn't available at build time (when running flatpak-builder).


Solution

  • As a workaround this I ended up creating a wrapper script that first copy the application in cache before running it.

    #!/bin/bash
    
    if [ ! -d "$XDG_CACHE_HOME"/workdir ]; then
        cp -r /app/data/ "$XDG_CACHE_HOME"/workdir
    fi
    
    exec "$XDG_CACHE_HOME"/workdir/app "$@"
    

    This works for my use case