Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hamish Jones   on Sep 17 In Java Category.

  
Question Answered By: Corbin Jones   on Sep 17

The manifest which I described is for creating an executable jar  which
can be run  either by a.) double-clicking on it or b.) executing java
-jar MyJar.jar from the command line. I assume this is what you are
trying to do and cannot?

Anyhow, the Class-Path line in the MANIFEST.MF file  just tells the java
runtime binary what the main class is (i.e. a class which has the method
public static void main(String[] args)). This class name can be
anything with this method (I used com.name.MainClass as an example, but
it could be FooBar or anything else for that matter.) Note also that
you must be very careful with case and other little details:

1.) The manifest must be in your JAR as /META-INF/MANIFEST.MF
2.) The Class-Path line must be capitalized properly (capital C,
capital P)
3.) I believe that ordering may even be important
4.) There must be a return after the Class-Path line, even if it is the
last line in the manifest.

I am not sure how you are building your applications, but you may want
to take a look at Ant ( http://jakarta.apache.org/ant ), a build tool
from the Apache Jakarta group. Ant takes care of a lot of these issues
when creating JAR files.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Jar files not created/loading correctly Or get search suggestion and latest updates.


Tagged: