bhavya
bhavya

Reputation: 719

creation of jar failing

I am trying to create a jar using the following command on a RHEL box

jar -cf first MANIFEST.TXT HelloWorld.class 

the contents of MANIFEST.TXT is Main-Class: HelloWorld

This is failing with the following error Failed to load Main-Class manifest attribute from first

I understand i need to create the manifest file which has Main-Class manifest even with this I cannot execute java -jar first without an error

Thanks Bhavya

Upvotes: 1

Views: 70

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328754

See the example from jar -help:

jar cvfm classes.jar mymanifest -C foo/ .

You must specify m so jar knows there is a manifest file and you should not omit the .jar from first. This should work:

jar cfm first.jar MANIFEST.TXT HelloWorld.class 

Upvotes: 3

Related Questions