Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In Java, how do I create a MANIFEST.MF with Main-Class: in it?

Status
Not open for further replies.

countrydj

ISP
Sep 27, 2002
21
GB
I have a .jar file which I have unzipped into it’s own directory.
The directory now contains a number of .class files.
I have converted the files into .java files.
I have found the file that a need to edit and edited it.
I have now converted it back to a .class file.
I now convert it to the original .jar file with the command: jar cf Creator.jar *
This creates a file called Creator.jar
When I try to run the file I get an error message:
Failed to load Main-Class manifest attribute.

The manifest.mf is:
Manifest-Version: 1.0
Created-By: 1.6.0_01 (Sun Microsystems Inc.)

And it should read:
Manifest-Version: 1.0
Created-By: 1.6.0_01 (Sun Microsystems Inc.)
Main-Class: Creator

Can anybody tell me how to create the .jar file to include Main-Class: Creator.

Thanks

John C
 
Hi stefanwagner..
Thanks for taking the trouble to reply to my post.
However, creating .jar file with the command:-
jar cf Creator.jar * does create a manifest automatically:-
Manifest-Version: 1.0
Created-By: 1.6.0_01 (Sun Microsystems Inc.)


However, the manifest needs to read:-
Manifest-Version: 1.0
Created-By: 1.6.0_01 (Sun Microsystems Inc.)
Main-Class: Creator

so that when the program is run, it knows to start with Creator.class
This is what I don't know how to do.
Can you help??

By the way, when I use the command jar cfm Creator.jar * I get an error message:
java.io.FileNotFoundException: Creator (Access is Denied)
at java.io.FileInputStream.open etc....


Does this mean anything ???

Many thanks...

John C
 
Hi stefanwagner..
I've solved the problem now.

I changed this: jar -cmf MANIFEST.MF Creator.jar *
to
jar -cmf manifest.txt Creator.jar *

and everything worked.

Many thanks for your help.

John C


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top