You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jeremy Whitlock <jw...@starprecision.com> on 2003/12/31 21:27:08 UTC

Problem with Class-Path in Manifest

Ant,
                I am currently having to add jars to my Class-Path
manually like so:
 
<property name="runtime.classpath" value="../lib/concurrent.jar
../lib/jdbc-MySQL.jar ../lib/jdbc-Oracle.jar ../lib/jdbc-PostgreSQL.jar
../lib/kunststoff.jar ../lib/jdom.jar ../conf"/>
 
This works great when building my jar and everything is good but I'd
like to build it dynamically so I tried this:
 
<!-- classpath -->
    <path id="classpath">
                <pathelement path="${basedir}" />
                <fileset dir="lib" >
                <include name="*.jar" />
                <include name="*.zip" />
                </fileset>
                <pathelement path="${conf.dir}"/>
    </path>
 
<property name="runtime.classpath" refid="classpath"/>
 
This works in the sense that the Class-Path is fully dynamic and no
matter what I add to the ${basedir}/lib folder, it will be included in
the Class-Path if it's a .jar or a .zip.  Well, when I do this, the .jar
will not execute where as before it did.  Can someone help me fix this
or diagnose the problem?  It seems like a bug since something so useful
aught to be usable.  Thanks,
 
Jeremy Whitlock --- MCP/MCSA
IT Manager for Star Precision, Inc.
Phone:  (970) 535-4795
Metro:  (303) 926-0559
Fax:  (970) 535-0780
Metro Fax:  (303) 926-8557
http://www.starprecision.com 
 

RE: Problem with Class-Path in Manifest

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.

> -----Original Message-----
> From: Jeremy Whitlock [mailto:jwhitlock@starprecision.com]
> Sent: Thursday, 1 January 2004 7:27 AM
> To: Ant
> Subject: Problem with Class-Path in Manifest
> 
> 
> Ant,
>                 I am currently having to add jars to my Class-Path
> manually like so:
>  
> <property name="runtime.classpath" value="../lib/concurrent.jar
> ../lib/jdbc-MySQL.jar ../lib/jdbc-Oracle.jar ../lib/jdbc-PostgreSQL.jar
> ../lib/kunststoff.jar ../lib/jdom.jar ../conf"/>
>  
> This works great when building my jar and everything is good but I'd
> like to build it dynamically so I tried this:
>  
> <!-- classpath -->
>     <path id="classpath">
>                 <pathelement path="${basedir}" />
>                 <fileset dir="lib" >
>                 <include name="*.jar" />
>                 <include name="*.zip" />
>                 </fileset>
>                 <pathelement path="${conf.dir}"/>
>     </path>
>  
> <property name="runtime.classpath" refid="classpath"/>
>  
> This works in the sense that the Class-Path is fully dynamic and no
> matter what I add to the ${basedir}/lib folder, it will be included in
> the Class-Path if it's a .jar or a .zip.  Well, when I do this, the .jar
> will not execute where as before it did.  Can someone help me fix this
> or diagnose the problem?  It seems like a bug since something so useful
> aught to be usable.  Thanks,
> 

Jar classpaths in a manifest are space separated. Try a pathconvert

    <pathconvert dirsep="/" pathsep=" " property="manifest.classpath">
      <map from="${lib.app.dir}" to="lib"/>
      <path>
        <fileset dir="${lib.app.dir}">

Conor

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