How to Convert a Java JAR into a Standalone EXE for JDK‑Free Installation

This guide walks you through converting a Spring Boot JAR into a Windows executable using exe4j and then packaging it with its bundled JRE into an installer via Inno Setup, enabling users to run the application on machines without any Java runtime installed.

Java Backend Technology
Java Backend Technology
Java Backend Technology
How to Convert a Java JAR into a Standalone EXE for JDK‑Free Installation

Prerequisites

You need a compiled, bug‑free JAR file, the exe4j tool for converting JARs to EXE, and Inno Setup for creating an installer that bundles the JRE.

Creating the EXE with exe4j

Open exe4j and select the Java to EXE wizard. Provide a name and output path for the executable, then choose the launch mode. Enable the option to support both 32‑bit and 64‑bit systems. In the VM parameters field add -Dfile.encoding=utf-8. Configure the JRE section to include a local JRE directory so the generated EXE can run without a separate JDK/JRE installation. Select Client VM and finish the wizard. After compilation you will obtain demo.exe on your desktop.

Packaging with Inno Setup

Launch Inno Setup, create a new script, and fill in the application name and version. Accept the default settings for most pages, then add the previously generated demo.exe as the main file. Specify the output directory and the name of the installer (e.g., setup.exe). In the script, add a line to copy the local JRE into the installation folder:

Source: "YourLocalJREPath\*"; DestDir: "{app}\{#MyJreName}"; Flags: ignoreversion recursesubdirs createallsubdirs

Compile the script; Inno Setup will produce setup.exe. When run, the installer copies the EXE and the bundled JRE, and you can optionally create a desktop shortcut.

Final Result

The resulting setup.exe can be distributed to users who do not have Java installed. After installation, they can launch the application directly from the shortcut or start menu, and it will run using the bundled JRE.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaSpring BootpackaginginstallerExe4JInno SetupJRE
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.