1

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.

5
  • How are you running it? What error messages are you getting? Commented Aug 19, 2013 at 2:22
  • @MadProgrammer 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. Commented Aug 19, 2013 at 2:25
  • 2
    That's not a problem with the Jar, that's a problem with Windows. Try "browsing" to the installation location of your JRE and selecting javaw.exe to open it... Commented Aug 19, 2013 at 2:26
  • @MadProgrammer OMG thank you so much, how the heck could I have missed that? Anyways how can I have your comment as my accepted answer? Commented Aug 19, 2013 at 2:31
  • By having me put it as an answer ;) Commented Aug 19, 2013 at 2:34

2 Answers 2

2

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...

Sign up to request clarification or add additional context in comments.

Comments

0

Have you set the main class in Properties ---> Run--> Select MainClass

3 Comments

"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"...
Ya I've set a main class through the projects properties.
run the program using the path like as C:\Test : java -jar proj.jar and tell the output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.