Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

AW: Class path error

Jan Materne

2008-05-14


Author LoginPost Reply
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@(protected)]
> Gesendet: Dienstag, 13. Mai 2008 19:41
> An: user@(protected)
> 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@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.