How can I make flatpak for applications like i2p (Java version)?

Hello everyone.

The Invisible Internet Project (I2P) is a fully encrypted private network layer. It protects user’s activity and location. I’m trying to make it flatpak’d. Now, I’ve met two problem.

The first is that this program uses an installer to put executable jar files under user’s home, for an instance, /home/tux/i2p. And it needs this directory to be writable, for plug-in installation and self-upgrade. So put it under /app won’t make it full functional. Should I write a wrapper to download it when user launch it and use --persists to keep it. Or should I bundle an installer and make a wrapper to execute it ?

The second thing is that this is a Java application. Is it necessary to rebuild it from source? Can I use official jar files?

Thanks in advance :smiley:

1 Like

Java applications can be run easily if you include the Java runtime, for instance here’s how I run one that I packaged: vet.rsc.OpenRSC.Launcher/vet.rsc.OpenRSC.Launcher.json at master · flathub/vet.rsc.OpenRSC.Launcher · GitHub

For /home/tux/i2p, you’re able to specify --filesystem=xdg-home/tux/i2p - You can see more here: Sandbox Permissions — Flatpak documentation

If you’re having issues with sandboxing during development and testing, you can also use Flatseal to test if you’re being overly restrictive. Generally as a best practice though, you should submit a patch upstream that allows you to change the location of the installation (either by default or a flag).

1 Like