Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't add Main-Class to jar file manifest

 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a jar file as follows:
jar cvf food.jar food

"food" is a directory containing "Fruit.java" and "Fruit.class"
Fruit.java just has an empty main method

I created a file "otherManifest.mf":
Main-Class: food/Fruit

I then updated the manifest:
jar uvmf otherManifest.mf food.jar

Java responded: updated manifest

But when I extracted the manifest, it did not have the Main-Class entry.

Where did I go wrong?

Thanks

Mike
[ August 22, 2004: Message edited by: Mike Gershman ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the required blank line at the end of your manifest?
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
needn't you use a dot: ?
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot to both of you.

The blank line was necessary for the jar command to process "otherManifest.mf".

The dot was necessary for the Main-Class value to actually work correctly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic