Is there a tool that will pack a copy of the JRE with my application so that it can run regardless of whether the user has Java installed?

This is my first brush actually distributing a Java application. I come from the Python background, which has a fantastic set of distribution tools called PyInstaller and Py2App. Both of these packages make up a copy of Python Interpreter along with the application, so there is nothing for the end user to install. They simply see .EXEor .appdouble-click on it, and the program starts.

So far, I have not been able to find a similar tool for Java. The idea of ​​this application is that it is stored on flashdrive, so it can be launched without installing anything on the host machine.

I found suitable tools for Windows. For example, Launch4J seems to do the trick, but only for windows. I desperately need similar functionality, but to create an application.

Has anyone encountered this riddle before? Are there any tools that I could use?

+5
source share
2 answers

Suppose you distribute via a .zip file

You can delete a copy of the JRE in your application directory, and then create a .bat and .sh script that will launch the application using the java command using the JRE located in the same directory.

This may be the best tool for this, but it is one of the ways this can be achieved.

Super simplified .sh script example

#!/bin/bash

jre/bin/java myapp.jar

myapp.jar, JRE . , , JRE .

:

myapp/
    jre/
    start.sh
    start.bat
    myapp.jar

jre JRE.

+3

install4j, Java- ( ). JRE .

enter image description here

: install4j

+3

All Articles