Create an .exe with Netbeans that lets you choose the installation directory

I have Netbeans configured in my project so that "Right Click Project -> Package As -> EXE Installer" will create an executable installer for the application.

The problem is that the installer installs the app locally at

C:\%USERNAME%\AppData\Local\ApplicationName

...

Is there a way to install the installer to select the installation directory, or at least install the app for all users?

we usually use C:\program files\...

+3


source to share


1 answer


I have not used the tools that Netbeans has built in as I find them very limited.

Netbeans uses Inno Setup to build its executables. While it may exist, I couldn't find where to edit the script that Inno uses to create these executables, so I did it myself.

I used this tutorial to combine all the dependencies in my application. If you have more than one, you add extra lines where the file says it.

I have used Launch4j to package my .jar as an .exe.



I used Inno Setup to execute this executable and install an installer with an icon, desktop icon and start menu icon and uninstall support. This is the script I used (mostly gui) with personal information removed:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[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 | Generate GUID inside the IDE.)
AppId=generated guid
AppName=app name
AppVersion=1.0
;AppVerName=app version name
AppPublisher=company name
AppPublisherURL=company name
AppSupportURL=company site
AppUpdatesURL=company site
DefaultDirName={pf}\app name
DefaultGroupName=app name
AllowNoIcons=yes
OutputDir=output directory
OutputBaseFilename=setup
SetupIconFile=icon directory
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "exe location"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\application name"; Filename: "{app}\exe file"
Name: "{group}\{cm:UninstallProgram,application name}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\application name"; Filename: "{app}\application name.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\application name.exe"; Description: "{cm:LaunchProgram,application name}"; Flags: nowait postinstall skipifsilent

      

I know this isn't really a lot of traffic, but I hope this helps anyone who comes across it later.

0


source







All Articles