You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sanjeev Pai <sp...@yahoo.com> on 2001/09/14 19:56:06 UTC

Question regarding classpath available to a Java Program running within Ant

Hi,

I am using Ant on Win2K to run tests on a program written to use the Kodo
JDO implementation. The build.sysclasspath property has been set to "ignore"
to ignore the system classpath and use the classpath specified in the <java>
property. Unfrtunately, the classpath available to the Java program from the
System Property java.class.path seems to be the one set by the ant.bat file,
effectively ignoring the path set by me in the build.xml file.

I have the following directive -

    <javac  srcdir="${test.home}/src"
            destdir="${test.home}/WEB-INF/classes"
            debug="${debug}"
            deprecation="on"
            excludes="**/test/*.java"
            >
        <classpath>
            <fileset dir="${java.home}/lib">
                <include name="**/*.jar"/>
            </fileset>
            <fileset dir="${j2ee.home}/lib">
                <include name="**/*.jar"/>
            </fileset>
            <fileset dir="${jaxp.home}/lib">
                <include name="**/*.jar"/>
            </fileset>
            <fileset dir="${jdo.home}/lib">
                <include name="**/*.jar"/>
            </fileset>
            <fileset dir="${jaxb.home}/lib">
                <include name="**/*.jar"/>
            </fileset>
            <fileset dir="${jaxp.home}/lib">
                <include name="**/*.jar"/>
            </fileset>
        </classpath>
    </javac>

When the following line executes -
System.out.println("classpath is " + System.getProperty("java.class.path") +
"\n");

The output is

classpath is
c:\jdk1.3.1\lib\tools.jar;c:\gnu\jakarta-ant-1.3\lib\parser.jar;c:\
gnu\jakarta-ant-1.3\lib\jaxp.jar;c:\gnu\jakarta-ant-1.3\lib\ant.jar;c:\jdk1.
3.1\
lib;c:\gnu\jakarta-ant-1.3\lib\ant.jar

This is the classpath set by the ant.bat batch file

How can the program see the classpath set by the build.xml file?

Rgds,
sanjeev pai