I originally 开发者_运维技巧had one project with just one class (called GetData) that worked well, and it had a main() method in it. Now, I got rid of the main method because I have to use this project as a library, and no matter what I do (yes, I went into properties), it won't generate a jar file that I can use! Is there a special way to do this? Also, I recently got Mercurial revision support on this project, so that might be a reason.
EDIT: I get "Finished building PROJECTNAME(clean, jar)" in the lower left hand corner when I do a clean build.
I am going to assume that your project is called DataGetter. You created the project by doing the following...
File->New Project and selected Categories: Java and Projects: Java Application on the New Projects dialog.
You have the Projects explorer open and it shows your project (DataGetter).
Select the Files item from the Window menu (control-2/clover-2 [on mac]).
A new explorer window will be displayed, titled Files.
You will see a 'node' labelled DataGetter, sort of like the node on the Projects explorer... but it has a different icon.
Expand that node and you will see a folder node labelled 'dist'. Expand that node to see your jar file, DataGetter.jar.
BONUS ANSWER:
If you are writing the application that will use this jar in NetBeans, you can make the DataGetter project a Library of the Application that you are developing. Look for a node labelled Libraries underneath your new Application project's node in the Projects explorer window.
If you want to have a jar that you can click and run you need a main method somewhere for it run. Library or not.
Are you getting an error message when you try to build it? Make sure there's nothing in main that if taken out would prevent it from compiling.
精彩评论