ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Class path error
Date Wed, 14 May 2008 04:58:37 GMT
A startable JAR file (java(w) -jar my.jar; doubleclick on the jar) needs two information:
- which class to start
- additional classpath entries
These information are made in the META-INF/manifest.mf in
- Main-Class: package.Driver_1
- Class-Path: path/one.jar path/two.jar
Ant's <jar> with nested <manifest> can build that jar.

Relative paths specified in Class-Path manifest entry are relative to the jar file itself.
This means for the example above that you have a directory layout like this:
  some
   \- place
         |my.jar
         \-- path
             one.jar
             two.jar

For creating the needed Class-Path have a look at the <manifestclasspath> task.
The creation of the required directory layout just use <mkdir> and <copy>.


Jan
        

> -----Urspr√ľngliche Nachricht-----
> Von: Van Dessel Ivan [mailto:IVanDessel@LIO.AACISD.com] 
> Gesendet: Dienstag, 13. Mai 2008 19:41
> An: user@ant.apache.org
> Betreff: Class path error
> 
> To run my project correctly I run "java package.Driver_1" after I run 
> command "source" on a script file that exports two directories of jar 
> files.  How do I implement the exporting of library jars into 
> my build 
> file for ant to make a jar file so that  I can just run it. I 
> have been adding
> attribute="Class-Path" refid="path/.jar path/.jar" into the 
> Manifest but it still
> is giving me errors by running the jar like this "java -jar 
> jarfile"  ?
> 
> Ivan Van Dessel
> Systems Engineer
> Advanced Acoustic Concepts
> 900 Technology Blvd., Suite C
> Bozeman, MT  59718
> (Phone) 406.582.8133
> (Fax) 406.582.0151 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message