ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rondev...@canada.com
Subject CLASSPATH in Java task
Date Tue, 13 Jul 2004 21:01:41 GMT
Can someone clear up some confusion for me with respect
to the classpath for the Java task in Ant 1.6.1,
running on Windows 2000.

I am trying to execute a Jar file but my Java task
doesn't appear to see the correct classpath. My program
displays the JVM variable "java.class.path" and it is
different than the classpath which the program actually
needs to see.

Here is my desired classpath and my Java task:

<path id="cp" description="classpath for executing
stored procedure clients from jars">
	<fileset dir="d:/sqllib/java">
		<include name="*.zip"/>
		</fileset>
	</path>

<!--Run-->
<target name="Q1_Run" description="Run the client.">
<java jar="${jar.dir}/${Question1.jar}" fork="true">
        <classpath refid="cp"/>
        </java>
</target>

My Classpath environment variable is set to
D:\sqllib\java\db2java.zip.

Despite the value of my classpath environment variable
and the classpath value I am setting in the java task,
the program itself displays 

CLASSPATH=D:\rds\jar\Income.jar

then fails because it is not able to load the JDBC
driver my program needs; this JDBC driver is in
d:\sqllib\java\db2java.zip, which appears in both my
classpath environment variable and my Java task.

I am completely baffled by this; I thought that the
Java task would use the classpath environment variable
if I didn't pass a specific classpath to the task.
Failing that, I assumed that if I specified the desired
classpath, that is what would be used. Instead, the
Java task seems to ignore BOTH the environment variable
AND the specified classpath. (For what it's worth, I've
tried coding the specific classpath three different
ways: none of the three ways produced an error message 
but none of them worked either.)

Can anyone tell me what I need to do to make the Java
task see the classpath I want so that my program runs?

I really need some help here; I've been banging my head
against the wall over this for hours.

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


Mime
View raw message