I have completed my project but unable to export in executable form. I'm using Netbeans 12.
Thanks to everyone who wanted to help me.
I got the solution myself and wanted to help new developers:
For JDK 14+ with modern IDEs:
Install JDK 14 or later on your system, if it's not already installed.
Open a terminal or command prompt and navigate to the directory containing your Java application and its dependencies.
Build your application using a build tool such as Maven or Gradle. Make sure to specify that you want to create a standalone executable JAR file.
Once your application is built, navigate to the directory containing the JAR file.
Run the jpackage command with the appropriate options to create a native installer for your application. Here is an example command to create a Windows MSI installer:
Example:
jpackage --input . --name MyApp --main-jar myapp.jar --type msi
This command assumes that your application JAR file is named "myapp.jar" and that you want to create a Windows MSI installer with the name "MyApp".
Here are some more examples and options for using jpackage to create native installers:
Specify an icon for the installer:
jpackage --input . --name MyApp --main-jar myapp.jar --type msi --icon myicon.ico
Specify an installer splash screen:
jpackage --input . --name MyApp --main-jar myapp.jar --type pkg --splash splash.png
Include a custom JVM option:
jpackage --input . --name MyApp --main-jar myapp.jar --type exe --java-options "-Xmx2g"
Set the installation directory
jpackage --input . --name MyApp --main-jar myapp.jar --type dmg --app-image myapp.dmg --app-image-dir /Applications
Create a ZIP archive instead of an installer
jpackage --input . --name MyApp --main-jar myapp.jar --type zip
For JDK 8 with NetBeans 8.2: (old but works)
- Start an Ant based standard project
- Enable native packaging inside Properties->Build->Deployment
- Install Inno setup tool for Exe, Wix Toolset for Msi (similar package manager for other OS)
- add bin paths of above tools as system environment variables
- right click on project and select package as->Exe or MSI