How to Turn a Spring Boot JAR into a One‑Click Windows Installer (EXE)
This step‑by‑step guide shows how to package a functional Spring Boot JAR into a Windows executable using exe4j, bundle the required JRE, and create a user‑friendly installer with Inno Setup so non‑technical users can install and run the application with a single click.
Preparation
Before starting you need three things:
A bug‑free, runnable JAR file of your Spring Boot application.
exe4j – a tool that converts a JAR into an EXE.
Inno Setup – a tool that packages the EXE together with its dependencies into a Windows installer.
Creating the EXE with exe4j
Open exe4j and choose Java to EXE . Click Next , then specify the output name and directory. Continue clicking Next to select the launch mode and enable both 32‑bit and 64‑bit compatibility.
In the VM parameters field add -Dfile.encoding=utf-8. Configure the bundled JRE by selecting the local JRE folder and choosing Client VM . Finish the wizard to generate demo.exe on the desktop.
Packaging with Inno Setup
Launch Inno Setup, choose File → New , 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.
On the Files page, add the local JRE directory using a script line such as:
Source: "YourLocalJREPath*"; DestDir: "{app}{#MyJreName}"; Flags: ignoreversion recursesubdirs createallsubdirsProceed through the remaining wizard pages, keeping defaults, and finally compile the script to produce setup.exe.
Run the generated installer; it will copy the EXE and bundled JRE, create a shortcut, and complete the installation. The resulting program can be distributed to users who do not have a JDK installed.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
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.
