aspose file tools
The moose likes Beginning Java and the fly likes Problem with JAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Problem with JAR file" Watch "Problem with JAR file" New topic
Author

Problem with JAR file

Sherry Jacob
Ranch Hand

Joined: Jun 29, 2005
Posts: 128
I made a simple swing application and packaged it in the same directory by the name MyJAR.jar.

Using the jar command on the command line, this is what i got:
D:\java_programs\swingClass>jar cvf D:\java_programs\swingClass\MyJAR.jar D:\java_programs\swingClass\*.*
added manifest
adding: D:/java_programs/swingClass/MySwingClass.class(in = 1153) (out= 680)(def
lated 41%)
adding: D:/java_programs/swingClass/MySwingClass.java(in = 705) (out= 355)(defla
ted 49%)

The JAR is created successfully in the same folder.

However, when I try to run the jar directly, I get the following:

D:\java_programs\swingClass>java -jar MyJAR.jar
Failed to load Main-Class manifest attribute from
MyJAR.jar

Why is this happening ? Any clues ? Am I missing something ?
Please guide.


<strong><br />Cheers !!<br /> <br />Sherry<br /></strong><br />[SCJP 1.4]
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
You need to have a manifest that indicates the entry point, or main class of your application:

http://java.sun.com/docs/books/tutorial/deployment/jar/manifestindex.html


There is no emoticon for what I am feeling!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Problem with JAR file
 
Similar Threads
Jar drive me crazy
Creating jar files
Creating a jar file from the command line
Reading a EAR file
applet in jar does not work