File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Netbeans jars versus Eclipse jars 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 "Netbeans jars versus Eclipse jars" Watch "Netbeans jars versus Eclipse jars" New topic
Author

Netbeans jars versus Eclipse jars

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Hi,

I usually use eclipse, and when I export a J2SE project, I get a jar file which I can simply double click to run it.

With netbeans 6.8, I do same thing (clean and build), then in the dist folder, theres also a jar.
When I try to run it, nothing happens. But if I drop the file onto ExecutorDemo, to make an exe, it then works (as it does with eclipses' jars).
But it doesn't work just as jar, and the actual jar size with netbeans is much bigger than with eclipse, even when compression is applied.

Can anyone tell me why netbeans jars dont run when double clicked, thanks.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

Have you examined the contents of the JAR file, including the contents of the manifest.mf files, to determine the difference? Another thing to try is running the JAR file the command line:

java -jar fromnetbean.jar

Then if there are any error they will be printed to stdout.

Most likely, the manifest.mf file in the JAR that NetBeans built is missing the Main-Class entry.

(The above are debugging suggestions and a guess - I never let NetBeans or Eclipse compile or package apps, that job I delegate to Maven or Ant).


JBoss In Action
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

If it's a NetBeans project, you need to specify the Main class in the project properties. NetBeans will then create a MANIFEST.MF that will contain the Main-Class entry.

Afterwards, you can simply double click the JAR (if you're in Windows) or run it in the command line via java -jar yourjar.jar

Hope it 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: Netbeans jars versus Eclipse jars