How to Package a Spring Boot Application into an Executable Installer Using exe4j and Inno Setup
This guide walks through preparing a Spring Boot jar, converting it to a Windows executable with exe4j, bundling the executable and a local JRE using Inno Setup, and creating an installer that runs on machines without a pre‑installed JDK.
The author, a senior architect, describes how to turn a Spring Boot jar that runs correctly into a Windows executable installer that can be used by non‑technical users.
Preparation includes a bug‑free jar, the exe4j tool for converting the jar to an exe, and Inno Setup for bundling the exe with a local JRE into a single installer. Download links and passwords for exe4j and Inno Setup are provided.
Using exe4j, the jar is selected, a name and output path are set, the launch mode is chosen, and the 32/64‑bit compatibility option is enabled. In the VM parameters the option -Dfile.encoding=utf-8 is added. The JRE is configured, the client VM is selected, and the wizard is completed.
After exe4j finishes, a demo.exe appears on the desktop. Inno Setup is then opened, a new script is created, and the installer’s basic information (application name, version, etc.) is filled in. The previously generated exe is added to the script, language and output path are chosen, and the wizard is run to the final script step.
In the script the local JRE directory is copied into the installer with the following line:
Source: "自己本地JRE路径\*"; DestDir: "{app}\{#MyJreName}"; Flags: ignoreversion recursesubdirs createallsubdirs
Compiling the script produces a setup.exe that bundles the exe and JRE; installing it creates a shortcut and the final program can be run on any Windows machine without a pre‑installed JDK.
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.