Project requirements :BS projects can be installed with one click and run without configuration.
Consider using Exe4J to package the Springboot JAR and JRE environment as an EXE and then InnoSetUp.
- The JAR package and JRE folder are available
- Generate the EXE using the exe4J-jar package
- Enter basic information program name and output program path
- The basic configuration of the program, since this is a Springboot program without a graphical interface, choose the output type Console Application
- Select the JAR package and the project main entry
- Select JRE to provide jre in case the JRE environment is not available on the installation PC
- Finish until the end
- Check whether the EXE is running properly
Inno SetUp script
- In the pit of
- DestDir: “{app}\jre”; DestDir: “{app}\jre”; DestDir: “{app}\jre”
- SOFTWARE\Microsoft\Windows\CurrentVersion\Run: key not found Because the 32-bit program will be under \HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run
; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName #define MyAppVersion #define MyAppPublisher #define MyAppURL #define MyAppURL Exe "#define MyAppAssocName MyAppName +" File" #define MyAppAssocExt ". Myp "#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt [Setup] ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, Click Tools | the Generate GUID inside the IDE.) AppId = automatically generated AppName = {# MyAppName} AppVersion = {# MyAppVersion}; AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={autopf}\{#MyAppName} ChangesAssociations=yes DisableProgramGroupPage=yes ; Uncomment the following line to run in non administrative install mode (install for current user only.) ; Groupesrequired =lowest OutputDir= Output folder Compression= LzMA SolidCompression=yes WizardStyle= Modern ShowLanguageDialog=yes [Languages] ; Download ChineseSimplified. Isl and place it in Inno SetUp https://github.com/kira-96/Inno-Setup-Chinese-Simplified-Translation Name: "cs"; MessagesFile: "compiler:Languages\ChineseSimplified.isl" Name: "english"; MessagesFile: "compiler:Default.isl" [Components] Name: main; Description:" Main program (required)"; Types:full compact custom; Flags:fixed Name: data; Description:" data file "; Types:full Name: helpo; Description:" Help file "; Types:full [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] ; Source: "D:\workstation\exe4j \{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Components:main Source: "D:\workstation\exe4j \ need file.exe "; DestDir: "{app}"; Flags: ignoreversion; Components:main Source: "D:\workstation\exe4j \ required file.jar "; DestDir: "{app}"; Flags: ignoreversion; Components:main Source: "D:\workstation\exe4j \jre\*"; DestDir: "{app}\jre"; Flags: ignoreversion recursesubdirs createallsubdirs; Components:main Source: "D:\workstation\exe4j \readme.txt"; DestDir: "{app}"; Flags: isreadme ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Registry] ; HKCR(HKEY_CLASSES_ROOT) ; HKCU(HKEY_CURRENT_USER) ; HKLM(HKEY_LOCAL_MACHINE) ; HKU(HKEY_USERS) ; HKCC(HKEY_CURRENT_CONFIG) Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0" Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: "" ; Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueName: The name you want in the registry. ValueData:{app}\{#MyAppExeName}.exe; Flags: uninsdeletevalue ; \HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run ; wow https://blog.csdn.net/yandede/article/details/12711739 Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Name you want in the registry "; ValueData: "{app}\{#MyAppExeName}" [Icons] Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon [dirs] Name:"{app}\ Help file "; Components: Helpo [Messages] BeveledLabel= Display name in the lower left corner of the installation interface [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent runhiddenCopy the code
The problem with this configuration is that every time you run the command line window, the service stops running when you close it, which is not the desired result. Originally wanted to use VBS to solve the problem of background running. However, VBS running 32-bit on 64-bit computers has not been solved. Double-clicking to run works, but an error occurs when InnoSetUp is launched. So consider using Windows as a service. The next one will document how Windows services are configured.
Or attach the VBS background exe script, path support relative path
Set WS=CreateObject(" wscript.shell ") WSCopy the code