ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From josh <>
Subject Re: Class-Path, and Me
Date Tue, 27 May 2003 01:12:55 GMT wrote:
> AFAIK the class-path attribute only applies to when you execute a file 
> using the "java -jar <jar-file>"
> These jars need to be placed relative to the jar you are executing. For 
> packaging purposes I find it neater to use
> <attribute name="Class-Path" value="lib/myjar.jar"/>
> and copy all the jars into a lib directory in the same directory as my 
> jar file.
> Ant will probably (and rightly) ignore this attribute if the jar is 
> included in a classpath.
> WH

That seems to be the case, although it's sort of a shame.  Does anyone 
know of any documentation that specifically says this?

>> Hi Everyone!
>> I saw a neat trick in the Batik source where they have a single 
>> batik.jar that contains nothing but a file that adds the 
>> other 7000 or so batik jars to the classpath.  So I decided to try it 
>> myself, for the reduced number of jars I needed in my application:
>> <target name="batik-jar">
>>   <jar destfile="${lib}/batik/mybatik.jar">
>>     <manifest>
>>       <attribute name="Class-Path" value="batik-ext.jar batik-dom.jar 
>> batik-css.jar batik-svg-dom.jar batik-gvt.jar batik-parser.jar [full 
>> list trimmed]"/>
>>     </manifest>
>>   </jar>
>> </target>
>> The ant task runs fine, and gets me a jar with only a 
>> inside, with these contents:
>> Manifest-Version: 1.0
>> Class-Path: batik-ext.jar batik-dom.jar batik-css.jar batik-svg-dom.ja
>>  r batik-gvt.jar batik-parser.jar batik-script.jar batik-bridge.jar ba
>>  //etc
>> Ok, the problem is that it doesn't work.  None of the classes in the 
>> jars listed in the manifest are found.  When I add 'mybatik.jar' to my 
>> classpath and recompile, everything barfs.
>> Any idea what I'm doing wrong?
>> - josh

View raw message