Wed Oct 22, 2008 4:57 pm
I created a jar file of a package.
And in the manifest file ,wrote the code
Main-Class:com.MyClass
There is no problem in creating the jar file using the following
command-
c:\>jar -cmf abc.mf MyJar.jar com
but when I tried to execute the program using
c:\>java -jar MyJar.jar
It thrown an error
Failed to load main class from manifest file.
Please provide solution to this problem.
Thanks in advance.
Wed Oct 22, 2008 4:58 pm
U have to create the jar file by giving the Main class in the
argument
You can create a file Manifest.txt having the following line
Main-Class: com.MyClass
then create the jar using the following command
jar -cmf Myjar.jar Manifest.txt com.MyClass
Then execute the command to run the jar file
java -jar Myjar.jar
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.