javainstallationjvmjava-runtime-compiler

Automatic and seamless way to install a JVM


i am programming an app for desktop targeting only windows, i would like a way to install the JVM automatically but with an additional option, i want the JVM to be a part of the app which mean you cannot uninstall the JVM and the only way to do it is by uninstalling my entire app and this way i don't have to deal with customer's complaining after deleting JVM the only way i know to do that is by making a private JRE and applying special paths to it. is there any simple and direct ways to wrap the installation process with the automatic installation of the JVM ?


Solution

  • You can use the jpackage tool.

    It is available since Java 14 and is "able to produce a native package in a platform-specific format".

    You can use it for example to package an application as .exe/.msi on windows.

    Example:

    package -n yourApplicationName -p ỳourModulePath -m your.module.name/com/example/YourMainClass
    

    This will create for example a .deb package on linux with the name yourApplicationName, containing an runtime image with exactly the required dependencies.