Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes jar problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar problem" Watch "jar problem" New topic
Author

jar problem

gidones hamami
Greenhorn

Joined: Feb 12, 2003
Posts: 3
Hi everybody!
If anyone can please help me, I want to run a jar on windows 2000 command prompt:
�java �jar jarName.jar�
I am getting this error message:
�Failed to load Main-Class mainfest attribute from jarName.jar�
Please give me some advises
Regards,
Gidone
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi gidones,

�Failed to load Main-Class mainfest attribute from jarName.jar�

That probably means that you don't have a main class declared in the manifest. Inside the jar file (which is only a zip file with a different extension) there is a directory META-INF and in that directory, there should be a file named MANIFEST.MF. In that file are contained attributes for the jar file. For a jar to be executable, there must be Main-Class attribute. Here is an example of what a MANIFEST.MF file might look like:

That would work if MyClass were in the default (undeclared) package. If it were in say myPackage.main then our manifest would look like this:

Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar problem