This is my first brush with actually distributing a Java application. I'm coming from a Python background, which has a fantastic set of tools for distribution called PyInstaller, and Py2App. Both of these package up a copy of the Python Interpreter along with the application so that there's nothing to install for the end user. They simple see an .EXE
or .app
double click it, and the program starts.
So far, I have been unable to find a similar tool for Java. The idea behind this app is that it's stored on a flashdrive so it can be run without installing anything on the host machine.
I've found decent tools for Windows. For instance, Launch4J appears to do the trick, but it's for windows only. I'm desperately in need of similar functionality, but for making an app.
Has anyone faced this conundrum before? Are there any tools which I could use?
Have a look at install4j, it's a multi-platform Java installer (and launcher) builder. You can bundle a JRE with your installers.
Disclaimer: My company develops install4j
Lets assume you are distributing via a .zip file
You could drop a copy of the JRE in your app directory, then create a .bat and .sh script that will run the app with a java command using the JRE that is in the same directory.
There is probably a better tool to do this but this is one way it could be achieved.
A super simplified example .sh script
#!/bin/bash
jre/bin/java myapp.jar
Would run myapp.jar using the JRE in that location. In reality you would want to put checks to make sure the JRE exists.
the app folder:
myapp/
jre/
start.sh
start.bat
myapp.jar
the jre would be an actual JRE instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With