0

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 ?

adamizzo
  • 3
  • 4
  • 1
    Depends on the Java version. OpenJDK is free and can be bundled with your application. When you use Java modules, you can use [`jlink`](https://docs.oracle.com/javase/9/tools/jlink.htm) to create an optimized runtime image containing JDK and application modules, but only those you actually use. Installing such an image reduces to extracting that directory to some target location. – Holger Apr 28 '21 at 07:22

1 Answers1

1

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.

JCWasmx86
  • 3,473
  • 2
  • 11
  • 29