File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAR not working" Watch "JAR not working" New topic

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?
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).]
wood burning stoves
subject: JAR not working
Similar Threads
Compiling Java for use in Windows...
unable to launch the application
Jdbc driver not found when putting an application in a jar-file
Using a jar in classpath on command line