• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with JAR file  RSS feed

 
Sherry Jacob
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!