Packaging a Spring Boot Application into an EXE Installer with exe4j and Inno Setup
This tutorial walks through converting a functional Spring Boot JAR into a Windows executable using exe4j, configuring a bundled JRE, and creating a single‑click installer with Inno Setup, providing step‑by‑step screenshots and command‑line details to avoid common pitfalls.
Introduction
Recently I built a combined front‑end/back‑end Spring Boot project and needed to deliver it as a simple executable for non‑technical users. After encountering many issues, I documented the entire process so readers can follow the steps and avoid the same problems.
Preparation
A bug‑free, runnable JAR file.
exe4j (tool to convert JAR to EXE). Download link: https://pan.baidu.com/s/127GG90sLOQR5XXTJhM0a1A, extraction code: 44im . Registration code: L-g782dn2d-1f1yqxx1rv1sqd .
Inno Setup (installer creator). The same Baidu Cloud link provides the installer.
Creating the EXE with exe4j
Open exe4j and proceed through the wizard:
Select "Java to EXE".
Enter the application name and output path.
Choose the launch mode and enable 32‑bit/64‑bit compatibility.
In the VM parameters field add: -Dfile.encoding=utf-8
Configure the JRE: point to a local JRE directory so the generated EXE can locate it without requiring a separate JDK installation.
Select "Client VM" and finish the wizard, which produces demo.exe on the desktop.
Packaging with Inno Setup
Launch Inno Setup (File → New) and follow the wizard:
Enter application name, version, and other basic information.
Accept default settings for most pages.
On the "Application Files" page, add the previously generated demo.exe .
Proceed through language selection and output path configuration.
In the final script, include the bundled JRE with a line such as: Source: " local‑JRE‑path \*"; DestDir: "{app}\{#MyJreName}"; Flags: ignoreversion recursesubdirs createallsubdirs
Compile the script to produce setup.exe , which installs both the EXE and the JRE on the target machine.
After installation, the user can run the program directly without any Java environment installed.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn 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.