I have completed my project but unable to export in executable form. I'm using Netbeans 12.
Java applications aren't built as exe files but as jar files. The component that makes them executable is the Main-class attribute defined in the META-INF file of the jar.
In NetBeans to turn your program into an executable jar file
1)Right Click on your project->Properties->Select Run Tab on the left corner of your screen. You will see an text box saying main class, select the drop down arrow to browse through all main classes available in your project (Yes NetBeans can have multiple main classes but will run only one)
2)Optional Select the deployment tab and select compress jar to save space
3)Right Click on project->Clean and build
Then go to your projects folder on your file explorer you will see an dist(distribution) folder and there you will see your built jar file named (Project Name).jar simply double click it and the java jre will execute it
Some people have a problem running the jar file with double clicking in that case either from cmd or from an bat file type this script
set path=<path to your java.exe in your JDK/JRE bin folder>
cd (Path to where your jar file is located)
java -jar <Your Jar file>.jar
You can use Files>Export>Browse to Export in netbeans.
Thanks for everyone who wanted to help me.
Easiest Solution:
Note:
Netbeans 8.2 is recommended (some features are deprecated in latest version)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.