Ant javac : How to print classpath?

R

Ronald Fischer

I have a problem compiling using Ant, which lets me suspect that
Ant does not use the classpath which I believe to have set up.
To debug this problem, I would like to output the classpath in
a "readable" fashion (preferably the exact value of the environment
variable CLASSPATH as it is seen by the compiler). How can this done?

Here is what I have:

<path id='p'>
<pathelement location='MySourceDir'/>
<fileset>...</fileset>
...
</path>

<target name='compile'>
...
<echo message='CLASSPATH=WHAT SHOULD I PUT HERE???'/>
<javac classpathref='p'>
....
</javac>
</target>
 
W

Wayne Berke

Ronald said:
I have a problem compiling using Ant, which lets me suspect that
Ant does not use the classpath which I believe to have set up.
To debug this problem, I would like to output the classpath in
a "readable" fashion (preferably the exact value of the environment
variable CLASSPATH as it is seen by the compiler). How can this done?

Here is what I have:

<path id='p'>
<pathelement location='MySourceDir'/>
<fileset>...</fileset>
...
</path>

<target name='compile'>
...
<echo message='CLASSPATH=WHAT SHOULD I PUT HERE???'/>
<javac classpathref='p'>
....
</javac>
</target>

Check out the documentation for <pathconvert> in the online Ant Manual:

http://ant.apache.org/manual/index.html

There is an example that does exactly what you want.

Wayne
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top