Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Beginning Java and the fly likes JAR not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAR not working" Watch "JAR not working" New topic
Author

JAR not working

Jason Stortz
Ranch Hand

Joined: Jan 11, 2001
Posts: 68
I have a bunch of .class files in the current directory, as well as a single line text file which has the following:
Main-Class: MyServer
Then, I move into that directory and use the following command:
jar mcf main-class.txt MyServer.jar *.class repository/*.class
This gives me a MyServer.jar file which is great. Then, I want to use:
java -jar MyServer.jar
to execute the application. Well, this doesn't seem to work. When I go back and unpack the jar with jar xvf MyServer.jar and look at the manifest file it doesn't have anything about the Main-class stuff in it!
Can anyone offer any advice?
Thanks
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
I've had a similar problem, but using class path in the manifest. Fixed it by using -M and including the META-INF directory.
It seems a lot easier just to zip up what you need, naming it .jar.
[This message has been edited by Michael Hildner (edited April 24, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAR not working