nbpackage
is a command line tool and library for packaging the NetBeans IDE or a NetBeans platform application into a native installer or package. It supports optional bundling of a Java runtime to make a self-contained application. It is inspired by the JDK's jpackage
tool, but tailored to the needs of the IDE and RCP, with a different range of packagers, and some support for cross-platform package building.
nbpackage is still under development.
Run nbpackage --help
to see options.
While options for the packagers can be set on the command line, the easiest way is to use the support for a configuration file in Java Properties format.
Use the --save-config
option to output all available options, or just the ones for a specific packager, to a properties file. Using a separate configuration file for each package type is probably the best option. The output file includes comments for each available option.
eg. to build an InnoSetup installer, first create the configuration file -
nbpackage --type windows-innosetup --save-config inno.properties
Edit the properties file, with package name, customized icons, path to Java runtime, etc. As well as the path to the native build tool.
Then build the installer from the IDE / RCP zip using -
nbpackage --config inno.properties --input <PATH_TO_ZIP>
Use the --verbose
option to see the output of the native packaging tools.
nbpackage
will first build an image - a directory with the correct layout and additional files for passing to the packaging tool. It is possible to use the --image-only
and --input-image
options to perform this in two separate passes to allow for customization of the process.
Only a few packaging types are supported so far - more to follow, including macOS bundles and Linux deb.
--type linux-appimage
Create a Linux AppImage. Requires download of the AppImageTool, making it executable, and adding the path to the configuration file.
--type linux-deb
Create a Linux DEB package. Requires dpkg
, dpkg-deb
and fakeroot
to be available on the system.
--type windows-innosetup
Create a Windows Inno Setup installer. Requires download of the installer tools, and adding the path to the iscc
compiler to the packager configuration. See also further information on the iscc tool.
Inno Setup works well with Wine for building installers on other OS. Write a short shell script that invokes the iscc
tool via wine
and use this in the packager configuration - eg.
#!/bin/sh wine C:\\Program\ Files\ \(x86\)\\Inno\ Setup\ 6\\ISCC.exe $1
--type zip
Mainly for debugging purposes, although can be used to bundle an RCP application with local runtime. As the IDE launcher does not yet support relative JDK location, this is less useful there.
Building nbpackage
requires Maven and JDK 11+. Building in the IDE or executing mvn package
will build the tool. Output can be found in target/appassembler
.
Run ./appassembler/bin/nbpackage --help
to check.