Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Problem in creating manifest file

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.



Re: Problem in creating manifest file

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

Post a reply
  Related Posts  to : Problem in creating manifest file
 I'm having a problem creating a Javascript form. Whats wrong     -  
 Creating a JAR file in Java     -  
 Restoring SQL Database from the .BAK File Problem     -  
 Encrypt/Decrypt a file from source file to target file.     -  
 Creating table using div tag     -  
 Creating a Method in jsp     -  
 Creating a Directory in php     -  
 Creating Effective Clouds     -  
 Creating your own Exceptions in Java     -  
 Creating Brushes with Illustrator     -