Friday, November 11, 2011

Failed to load Main-Class manifest attribute from Test.jar

If you get below mentioned error

Failed to load Main-Class manifest attribute from Test.jar

Possible reason could be you missed Entry Point of a JAR file. Make sure that Manifest.txt contains Main Class.

Main-Class: MyPackage.MyClass


In some cases if there are multiple Entry points i.e. there is not any specific Main-Class in Manifest and you need to provide main class at run time then you can use below mentioned simple method.


java -cp Test.jar MyPackage.MyClass1
 
java -cp Test.jar MyPackage.MyClass2