#how can i make an .exe that doesnt require java installed even if it uses java?

1 messages · Page 1 of 1 (latest)

kind gyro
#

what the tile says

wary kindleBOT
#

Helper please have a look, thanks.

trail quartz
#

you prefer anythign?

#

like jpackage?

wary kindleBOT
#

Due to the JVM and bytecode as intermediate execution stage, turning a Java application into a standalone executable (exe, msi, deb, rpm, dmg, pkg) is not trivial.
However, there exist various tools to do the job. They mostly differ in the details of the solution they create and hence also in their purpose:

  • jpackage (the official tool) - creates an installer
  • Launch4J - creates a wrapper executable that unwraps on execution
  • GraalVM - attempts to create an actual native executable instead of wrappers or installers

This guide explains how to use jpackage, an official tool that is available in all JDKs since Java 16. The tool creates an installer for the application, so the end-user will get an executable that guides them through a setup where they can select installation path and tweak other settings, finally resulting in the application being installed on the machine (with a proper uninstaller, desktop shortcuts, start menu entries, ...): https://i.imgur.com/2V5ovUu.png

As an example, suppose you have a fat jar of your application called HelloWorld.jar, with a main class called Main. Put the jar into a dedicated release folder for simplicity. Execute the following command and you have an installer for your application in a folder called installer:

jpackage --input "release" --dest "installer" --main-class "Main" --main-jar "HelloWorld.jar" --name "HelloWorld" --win-dir-chooser --win-menu --win-shortcut --type exe

See the official documentation for more information on the available commands and for other operating systems:

Here is an example for a more complex setup which also associates file endings to the application, has a custom icon and more: https://pastebin.com/cfzqSKnW

trail quartz
#

or launch4j etc

kind gyro
trail quartz
#

I would suggest launch4j

#

check this answer

mortal solstice
#

If you are still looking for help in this area take a look at this video just between the 1.30 and 2.10 section. If this is what you are trying to do then let me know. https://youtu.be/GbFsfXR2GWE?si=DLVV5DfwSwGMJQ4w

Showcasing the JavaFX Appointment Reminder application. This is an application to entering in the date and time of an appointment as well as the client.
The month, week, and day calendar views allow you to see upcoming appointments.
The video demonstrates the application installer in action as well as the application and the files that comprise...

▶ Play video