This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
Similar Threads
unable to launch the application
Compiling Java for use in Windows...
:org/apache/log4j/Logger
Using a jar in classpath on command line
Jdbc driver not found when putting an application in a jar-file