File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes jar file manifest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "jar file manifest" Watch "jar file manifest" New topic
Author

jar file manifest

Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I have added the Main-Class heading to the manifest of my jar file. I am not using packages. When I try to run the jar file I get a NoClassDefFound error. I have verified that the class is in the jar. When I run the class outside of the jar it works. My classpath appears to be ok. Does anyone have any ideas on this?


Matthew Phillips
Jason Kretzer
Ranch Hand

Joined: May 31, 2001
Posts: 280
Well, there are a couple of things. First, in your manifest file, make sure you are using Main-Class: with a space after the colon. Make sure the class name on the Main-Class: line does not have the .class extension on it.
Next, when creating the jar make sure you are using the right command:
jar cvmf <name of manifest> <name of jar>.jar <all files to be included>
I apologize if this is too simplistic but I don't know your background.
HTH,


Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
That seemed to do it. I had two spaces after the Main-Class heading. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar file manifest