3

I am using Inno 5 Setup Installer in Netbeans to build my Java Swing application into an executable set up file. It creates an app.exe setup file with all the lib(all jar file) and app.jar.

So once user executes app.exe file, it create a folder at C:\users\username\local\appname which has the app.jar file and the libraries.

Is it possible to add additional text files in app.exe setup? so these text files will also be avaliable in "appname" folder when executed. These are required for the app to run.

Thanks for your time :)

Deanna
  • 23,876
  • 7
  • 71
  • 156
Vijay Vennapusa
  • 169
  • 3
  • 15
  • Sure, you can list what you want to copy in the [`[Files]`](http://www.jrsoftware.org/ishelp/index.php?topic=filessection) section. The `{app}` constant shown in the help examples is just the target directory chosen by the user. – TLama Jul 24 '14 at 15:04
  • @TLama, Currently I am doing this by right click on Project -> Package as -> EXE Installer. Where can I find the file to edit, as you mentioned? – Vijay Vennapusa Jul 24 '14 at 15:15
  • It should generate an *.iss file with the Inno Setup script. But I can't tell you where since I'm not familiar with Netbeans at all. Also, if you find and modify that script, you'll need to rebuild it with the Inno Setup compiler again. And I think that you'll need to do that manually which somehow breaks your build process. I would rather wait for someone experienced with Netbeans Inno Setup integration. – TLama Jul 24 '14 at 15:22

2 Answers2

2

In Inno Setup there is a ScriptWizard which i recommend to use. After a few steps there comes this window:

NOTE: I use the application from Inno Setup. I got the Screenshot from there. Script Wizard image

If you click on "Add files" you now can select your text file and it will be setup within your path.

If you don't want to use the wizard, you can add your additional files as entries in the [Files] section, like for instance:

[Files]
Source: "C:\path\to\your\text\file\you\want\to\add\to"; DestDir: "{app}"

Except listing one entry per file, you can add e.g. all files of a certain extension from a given directory.

TLama
  • 75,147
  • 17
  • 214
  • 392
Rubinum
  • 547
  • 3
  • 18
  • 1
    Hm, interesting. The question reads as *"is it possible to add additional text files in app.exe setup ?"*, where I would expect that the script is already generated (by Netbeans ?). In that case is using that wizard totally pointless. – TLama Aug 15 '14 at 10:38
0

When you right click your project in NetBeans then Package as -> Exe installer, then NetBeans does several things:

  • bundels your app in an exe and adds JRE files
  • creates an Inno script for you
  • executes the inno script and create the installer

This is nice but, if you need to change stuff like add more files, app name, vendor, version, install location, icons, etc... you need to edit the .iss file. But...where is that .iss file NetBeans creates?? -> check below for answer

The cleanest way to have an installer, and a native executable for your Java app developed in NetBeans is the following:

  • check the instructions here, to enable native packaging https://netbeans.org/kb/docs/java/native_pkg.html
  • Build your app
  • Right click on NetBeans project -> Package as->Exe installer. This step is to obtain the .iss setup file produced by NetBeans. You can use it as starting point.
  • The .iss file is generated at C:\Users\YOUR_USER_NAME\AppData\Local\Temp\fxbundler[somenumbers]\images\win-exe.image\YOUR_PROJECT_NAME.iss
  • build and clean the project again
  • Right click on NetBeans project -> Package as-> Image only. This will wrap your app in an .exe and will add JRE files needed to run the app.
  • The exe and dependencies will be generated in dist\bundles
  • Add more files in the app folder based on your needs
  • take the above YOUR_PROJECT_NAME.iss script, along with your files from dist\bundles, adapt YOUR_PROJECT_NAME.iss script based on your needs and generate your installer for your java wrapped in a native executable.

Good luck!

Florin Virtej
  • 435
  • 4
  • 7