Thursday, January 24, 2013

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


Problem :


We come across this common exception when we are trying to execute a packaged jar file. Lets see how we can resolve this.

Exception I Encountered Was :


#########################################################################################
Failed to load Main-Class manifest attribute from /nfs/home/mrahamatullah/StaleContentProj.jar #########################################################################################

Solution :


This exception was caused when i compiled the jar file without the manifest file and was executing it.
The exact way to compile the jar file is to run :
From the jar files location > jar cvfm *.*
Where ManifestFile includes the classpath and main class definition.


Example :


jar cvfm StaleContentProj.jar manifest.txt *.*


Similar Exception :

     
- Failed to load Main-Class manifest attribute from