Tutorial to create AppImage out of Java application


I am the new maintainer of a Java open source software. Historically the software was distributed as .exe, .dmg, .rpm and .deb and as the new maintainer I would like to continue to support the 3 Os. At the moment I am managing the builds for .exe and .dmg but I don’t know how the .deb and .rpm were generated. I cam across AppImage and I think it may be the solution for me, but I could not find an in-depth tutorial, hence I have the following questions:
- can someone share ressources on how to build step by step an AppImage out of Jar application ?
- is is possible to build the flatpack from windows platform or will I need to use a virtual machine for this?

Thank you in advance for your help.

1 Like

I don’t know about Flatpak (it is a different project) but it is easy to build an AppImage from a jar. Essentially you bundle JRE and the application into the AppImage.

I don’t know if it is possible using Windows (possibly it is but I don’t have a Windows machine), so I think the easiest solution for you is to use a service like Travis CI or GitLab CI that builds the AppImage in the cloud.

Here are some examples of yml recipes for Java applications:

You run these using the pkg2appimage command on a Debian/Ubuntu machine.

I am the new maintainer of a Java open source software.

Can you point me to your software? If it is living on GitHub or GitLab, I may even be able to send you a pull request/merge request that would build the AppImage for you.


If you’re using Eclipse, you might be interested in this plugin: https://gitlab.com/brotenet/ide.appimage.export

Thank you very much for proposing your help.

The project is hosted here: https://github.com/akasolace/HO (the GitHub project just has one commit because it was just moved out from SourceForge but in reality it is an old project)

I guess it will be easier for you if I upload a release, I can do that later today.

But what is really produce by the build system is:

  • a folder with external JARs (no JRE at the moment)
  • some resources, mostly gifs
  • a java class (the application updater), the application as a JAR
  • and a script Launcher (.bat or .sh)

the script basically launch first the updater and then the application.
Hence, the update part work as follow:

  1. from the app, user can check for new version and download update in practice a .update zip file
  2. at next start the updater unzip the file in the application repository

I am not sure whether or not an AppImage can manage the update part - fyi it also works like this for the dmg Image). But in case that part is not possible, I think it will be acceptable to ask Linux users to download new version instead of using the updating part.

Thank you in advance for your help.

Oracle is making it so hard to download JRE these days. Is there a way to get the latest one using wget?

I could not find a downloadable JRE link either.
I am also ready to build it using an Ubuntu or Debian VM. In that case, would that be possble to get the JRE from repository? Also, would that help if I first manage to create a .deb for my app?

Making a deb for your app is not needed. Finding a download link for JRE is. Possibly openjre packages from Ubuntu 14.04 can be used, but I have not tried that route so far.

https://github.com/probonopd/SystemImageKit/blob/master/boot/bin/generate-java-extension has:

URL=$(wget -qq "https://www.java.com/en/download/linux_manual.jsp" -O - | grep "Linux x64 en JRE" | head -n 1 | cut -d '"' -f 4 | xargs)
wget "$URL" -O - | tar xfvz -