Total members 11895 |It is currently Thu Dec 26, 2024 7:16 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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.




Author:
Proficient
User avatar Posts: 280
Have thanks: 1 time

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

_________________
Please recommend my post if you found it helpful


Author:
Proficient
User avatar Posts: 228
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  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 a Method in jsp     -  
 Creating a Directory in php     -  
 Creating table using div tag     -  
 Creating Glass Buttons     -  
 Creating a Database in MySQL     -  
 creating database in netbeans     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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