How to Package a Spring Boot Application into an Executable (EXE) Using exe4j and Inno Setup
This guide walks through converting a functional Spring Boot jar into a Windows executable using exe4j, then bundling the exe with a local JRE into a single installer with Inno Setup, providing step‑by‑step instructions, required tools, configuration details, and a code snippet for the installer script.
The author created a combined front‑back Spring Boot project and needed to deliver it as an executable file for non‑technical users, so they documented the whole process of turning a jar into an EXE and packaging it with a JRE.
Prerequisites : a bug‑free Spring Boot jar, the exe4j tool (download link with extraction code vhoy and registration code L-g782dn2d-1f1yqxx1rv1sqd ), and Inno Setup (download link with extraction code wphi ).
Using exe4j : open exe4j, select “Java to EXE”, set the output name and path, choose the launch mode, enable 32‑bit and 64‑bit compatibility, add the VM parameter -Dfile.encoding=utf-8 , select “Client VM”, and finish the wizard. The result is a demo.exe file on the desktop.
Using Inno Setup : start a new script (File → New), fill in the application name and version, keep the default settings, add the generated demo.exe and the local JRE directory, choose the language, set the output path and installer name, and edit the script to copy the JRE:
Source: "your local JRE path\*"; DestDir: "{app}\{#MyJreName}"; Flags: ignoreversion recursesubdirs createallsubdirs
Compile the script, wait for the green progress bar to finish, and a setup.exe installer will be created on the desktop. Running this installer installs the application and creates a shortcut, allowing the program to run on machines without a JDK.
The final installer can be distributed to users, who can simply run the setup to use the Spring Boot application as a native Windows program.
Java Architect Essentials
Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.