• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Error while creating jar file in Command Prompt...  RSS feed

 
Durga Kannan
Greenhorn
Posts: 22
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I created my first jar file by giving
"c:\java>jar -cf myjar.jar manifest.txt *.class"
It created successfully. But while testing my jar by giving
"c:\java>myjar.jar"----------> Error message box is popped out telling " FAILED TO LOAD Main-Class ATTRIBUTE FROM C:\JAVA\MYJAR.JAR".

P.S:
1)Iam having my java file & class file in the following path:
c:\java.

2)I created class path also(c:\java>set path="c:\ProgramFiles\java\jdk1.6.0_10\bin";

please assist me
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

You didn't specify that you wanted to use manifest.txt as your manifest file; you need the "m" flag for that. Because you didn't specify your own manifest file a default one is created, and that's missing the Main-Class attribute.
 
Durga Kannan
Greenhorn
Posts: 22
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Rob,
Thanks a ton..but still iam in need of correct syntax of manifest flag usage"-m". Could you please assist me telling the correst syntax for creating jar file with default manifest file?
Thanks in advance!!
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://download.oracle.com/javase/tutorial/deployment/jar/build.html
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Durga Kannan,
Your post was moved to a new topic.
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Durga Kannan,
Your post was moved to a new topic.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!