ANT: Verify Classpath

P

Prabh

Hello all,
How can I echo/print the CLASSPATH being used in my ANT tasks?
I want to verify if its proper and change it if incorrect.

I used a,

<echo> CLASSSPATH = "${classpath}" </echo>

It doesnt work, instead echoes out the literal string "${classpath}",
but somehow the target's working and does the compilation too, so I
know it is being set, I just cant seem to print it out.

Is there any other variable I should print out, I tried
${java.class.path}, but thats the System.property and I'm sure is
being changed within the task execution.

Thanks for your time,
Prab
 
?

=?ISO-8859-15?Q?G=E9din_Fr=E9d=E9ric?=

Prabh said:
Hello all,
How can I echo/print the CLASSPATH being used in my ANT tasks?
I want to verify if its proper and change it if incorrect.

I used a,

<echo> CLASSSPATH = "${classpath}" </echo>

try <echo message="CLASSSPATH = ${classpath}" />

Frederic
 
T

Tony Morris

Prabh said:
Hello all,
How can I echo/print the CLASSPATH being used in my ANT tasks?
I want to verify if its proper and change it if incorrect.

ant -v

--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)
 
P

Prabh

try said:

Thanks for the response, Frederic.

I tried, <echo message = "CLASSPATH = ${classpath}" />
It still prints out,
[echo] CLASSPATH = ${classpath}

The literal "${classpath}".

Thanks,
Prab
 
T

Tony Morris

I tried said:
It still prints out,
[echo] CLASSPATH = ${classpath}

The literal "${classpath}".



<echo message="${java.class.path}"/>

or better still, execute ant with the verbose option:

ant -v

--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)
 
?

=?ISO-8859-15?Q?G=E9din_Fr=E9d=E9ric?=

Prabh said:
try <echo message="CLASSSPATH = ${classpath}" />

Frederic

Thanks for the response, Frederic.

I tried, <echo message = "CLASSPATH = ${classpath}" />
It still prints out,
[echo] CLASSPATH = ${classpath}

The literal "${classpath}".

Thanks,
Prab

Then the classpath parameter is probable not defined.

Frederic
 
T

Tony Morris

Then the classpath parameter is probable not defined.

I assume you are confusing the java.class.path system property with the
"classpath parameter" ?

--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)
 
Joined
Sep 26, 2007
Messages
1
Reaction score
0
ANT Verify classpath

This can be done in this way

<!-- Sets up the classpath -->
<path id="main.classpath">
<pathelement location="${src}"/>
</path>

<!-- Display the classpath -->
<target name="printclspath">
<property name="myclasspath" refid="main.classpath"/>
<echo message="classpath= ${myclasspath}"/>
</target>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top