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
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
精彩评论