Jar File Manifest

I am creating a jar file for an application that has several classes.  I created the jar file with the command "jar cf app.jar *.class".  When I try to run the jar file, I type in "java -jar app.jar" and I get the error
"Failed to load Main-Class manifest attribute from app.jar".  How do I either modify the manifest file to give it the attribute it wants or how do I create the jar file with the needed attribute?
balyonAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vladi21Connect With a Mentor Commented:
-jar
Execute a program encapsulated in a JAR file. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must contain a line of the form Main-Class: classname. Here, classname identifies the class having the public static void main(String[] args) method that serves as your application's starting point. See the Jar tool reference page and the Jar trail of the Java Tutorial for information about working with Jar files and Jar-file manifests.
When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.

---
so look at http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/jar.html

0
 
vladi21Commented:
look
--
sun JAR tutorial http://java.sun.com/docs/books/tutorial/jar/index.html
---
JAR format http://developer.netscape.com/docs/manuals/signedobj/jarfile/jar.htm
http://java.sun.com/products/jdk/1.2/docs/guide/jar/manifest.html 
http://developer.java.sun.com/developer/Books/JAR/basics/manifest.html
Manifest files can contain arbitrary information about the files in the archive,
such as their encoding or language. If the JAR archive is intended for use with
the SmartUpdate feature of Communicator, the manifest file must include, at a minimum,
the address of the installation file
0
 
vladi21Commented:
http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/java.html

The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method. The method declaration must look like the following:
    public static void main(String args[])

The method must be declared public and static, it must not return any value, and it must accept a String array as a parameter. By default, the first non-option argument is the name of the class to be invoked. A fully-qualified class name should be used. If the -jar option is specified, the first non-option argument is the name of a JAR archive containing class and resource files for the application, with the startup class indicated by the Main-Class manifest header.
The Java runtime searches for the startup class, and other classes used, in three sets of locations: the bootstrap class path, the installed extensions, and the user class path.

Non-option arguments after the class name or JAR file name are passed to the main function.

0
All Courses

From novice to tech pro — start learning today.