• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Netbeans jars versus Eclipse jars

 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic