I've created a java project in Netbeans an am now stuck in the build stage. Everything in my project is set, I have a main class set in its properties and I even set my project as the main project. When I do a "Clean and Build", a dist folder is created with my .jar file. However, the .jar file is not executable, why? I opened the .jar file and looked at the manifest, a main class is specified, so what's the problem? I'm running Netbeans 7.3.1. Thanks.
2 Answers
Well when I double click the .jar file, Windows doesn't know what program to use to open it. So it opens up a dialog box for me to pick what program Windows should use
The problem isn't with the Jar file but with Windows. You need to register (preferably) javaw.exe as the default application to use when you want to open (double click) a Jar file.
When the dialog popups, browse to the installation location of your JRE and select javaw.exe from the bin folder...
Comments
Have you set the main class in Properties ---> Run--> Select MainClass
3 Comments
MadProgrammer
"Everything in my project is set, I have a main class set in its properties and I even set my project as the main project"...
Navio53
Ya I've set a main class through the projects properties.
muthukumar
run the program using the path like as C:\Test : java -jar proj.jar and tell the output
javaw.exeto open it...