I’m developing my first Java application and I’m thinking about how I will distribute it. I read the guide on how to create an AppImage of a Java application and I find the procedure very easy. My only problem with the approach described in the documentation is that my application is only a few Mb and including the JRE would greatly increase its size.
So I was wondering if you can create an AppImage that uses the system JRE, that is, the AppRun file launches the JRE with the application as an argument and in case the system JRE is not compatible (or it isn’t avalaible) show a FLTK dialog with the error information (in a similar way to what Launch4j and other wrappers do on Windows).
What do you think ?
If you’re using the Eclipse IDE you can check out my plug-in for exporting Java applications to AppImages.
I guess one way to go would be to create 2 bash scripts as follows:
java-check.sh – Check if Java is installed. If Yes then run application, else, if No then display a terminal dialog message using the ‘dialog’ command.
show-dialog.sh – Use it in (or the code in it) your AppImage startup shell script to run the java-check.sh script via the ‘x-terminal-emulator -e’ command.
if [ -n
which java ];
echo “Java is installed”
add application execution code here
echo “Java is not installed”
dialog --title “Java check” --msgbox ‘Java is not installed’ 6 40
x-terminal-emulator -e ./java-check
thanks for the advice, with your plugin already would be fine, since with the option “none” I could not include the JRE. But I also like the solution with the two scripts, I read that you can show graphical dialogs even from bash, without using a GUI toolkit, I do not know if it’s true
Yes, it is true. Basically the ‘dialog’ command that I use in the ‘java-check.sh’ script works as you described (non-GUI dialogs).
That is basically the reason that I have ‘java-check.sh’ as a separate script that gets executed by the x-terminal-emulator command (in ‘show-dialog.sh’). To pop-up a terminal window instead of a gui-message-box.
BTW. I was thinking of implementing the generation for such a check in the plug-in as an optional feature… I guess I’ll be adding it in a future release.