File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

How to generate jar using NetBeans

Enrique Nivasch

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?


Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

Welcome to JavaRanch!

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

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, 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:
subject: How to generate jar using NetBeans
It's not a secret anymore!