aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes How to generate jar using NetBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to generate jar using NetBeans" Watch "How to generate jar using NetBeans" New topic
Author

How to generate jar using NetBeans

Enrique Nivasch
Greenhorn

Joined: Aug 10, 2008
Posts: 2
I am using NetBeans 6.1 to develop my software on a Vista based machine. My application is currently made up of two classes that live as two separate source files. When I click on the Run Main Project button on the IDE everything works fine. If I click on the Build Main Project button and the double click on the generated .jar file that sits in the dist folder I get a �Could not find the main class. Program will exit.� Message. How should I generate the jar file so it will run?


Thanks,

Enrique
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29274
    
140

Enrique,
Welcome to JavaRanch!

We have a forum dedicated to IDEs. I'll move this for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

It's because there's no Main-Class field in your MANIFEST.MF. In order for NetBeans to add the Main-Class field in the MANIFEST.MF, you need to set the main class in your NetBeans project.
1. Right click on the project->Properties->Run
2. Set the main class.

Hope this helps.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to generate jar using NetBeans
 
Similar Threads
When I Run Main Project in NetBeans (F6) It always runs a project that isn't even open
Default netbeans servlet with JSP file
Run JAR file in Applet
Is this an applet?
Application not running from jar