Quantcast

How to display the classpath that Ant is using to launch the java task?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to display the classpath that Ant is using to launch the java task?

fjanon
Is there anything to display the classpath that Ant is using to launch
a java task besides the verbose and debug ant options that don't
display it?

How can I debug Ant file in general? I check the Ant manual left and
right and didn't find anything.

Thanks

Fred


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: How to display the classpath that Ant is using to launch the java task?

Jan.Materne
There isnt any built-in debug option.
You could do some logging with <echo>.

Maybe some IDEs support debugging of buildfiles (I think Eclipse can).


Jan

> -----Urspr√ľngliche Nachricht-----
> Von: Fred Janon [mailto:[hidden email]]
> Gesendet: Mittwoch, 27. Februar 2008 03:39
> An: [hidden email]
> Betreff: How to display the classpath that Ant is using to
> launch the java task?
>
> Is there anything to display the classpath that Ant is using to launch
> a java task besides the verbose and debug ant options that don't
> display it?
>
> How can I debug Ant file in general? I check the Ant manual left and
> right and didn't find anything.
>
> Thanks
>
> Fred
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display the classpath that Ant is using to launch the java task?

Ramu Sethu-2
In reply to this post by fjanon
Hope these things helps you

If u want specific path element to get printed
<path id="classpath">
    <fileset dir="lib"></fileset>
 </path>
 <property refid="lib" name="lib.prop"></property>
 <echo>${prop}</echo>

(or)

  <target name="test">
        <echo>${java.class.path}</echo>
   </target>

Let me know if i am wrong

On Wed, Feb 27, 2008 at 8:08 AM, Fred Janon <[hidden email]> wrote:

> Is there anything to display the classpath that Ant is using to launch
> a java task besides the verbose and debug ant options that don't
> display it?
>
> How can I debug Ant file in general? I check the Ant manual left and
> right and didn't find anything.
>
> Thanks
>
> Fred
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Thank you
Ramu S

 If A is success in life, then A equals x plus y plus z. Work is x; y is
play; and z is keeping your mouth shut.
- Albert Einstein
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display the classpath that Ant is using to launch the java task?

Ramu Sethu-2
most of the time -debug and -verbose options should help u in debugging

If your build is too huge, redirect them to a file

On Wed, Feb 27, 2008 at 11:39 AM, Ramu Sethu <[hidden email]> wrote:

> Hope these things helps you
>
> If u want specific path element to get printed
> <path id="classpath">
>     <fileset dir="lib"></fileset>
>  </path>
>  <property refid="lib" name="lib.prop"></property>
>  <echo>${prop}</echo>
>
> (or)
>
>   <target name="test">
>         <echo>${java.class.path}</echo>
>    </target>
>
> Let me know if i am wrong
>
>
> On Wed, Feb 27, 2008 at 8:08 AM, Fred Janon <[hidden email]> wrote:
>
> > Is there anything to display the classpath that Ant is using to launch
> > a java task besides the verbose and debug ant options that don't
> > display it?
> >
> > How can I debug Ant file in general? I check the Ant manual left and
> > right and didn't find anything.
> >
> > Thanks
> >
> > Fred
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> Thank you
> Ramu S
>
>  If A is success in life, then A equals x plus y plus z. Work is x; y is
> play; and z is keeping your mouth shut.
> - Albert Einstein




--
Thank you
Ramu S

 If A is success in life, then A equals x plus y plus z. Work is x; y is
play; and z is keeping your mouth shut.
- Albert Einstein
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display the classpath that Ant is using to launch the java task?

Garrett-3
In reply to this post by fjanon
On Tue, Feb 26, 2008 at 6:38 PM, Fred Janon <[hidden email]> wrote:
> Is there anything to display the classpath that Ant is using to launch
>  a java task besides the verbose and debug ant options that don't
>  display it?
>
This might not be the answer to what you want to do, but...

Ant should be using PATH, variable.

Are you using Windows? If so...
Start -> Control Panel...
Double click on "System"...
In the System Properties, choose "Advanced" tab.
Click "Environment Variables" button
set system properties.

If JAVA_HOME is in "Program Files", change that to C:\Progra~1\Java\...

I know it's not exactly what you asked, but thought it might help anyway.

This might help, too:
http://www.catalysoft.com/articles/TopAntTips.html

Garrett

>  How can I debug Ant file in general? I check the Ant manual left and
>  right and didn't find anything.
>
>  Thanks
>
>  Fred
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [hidden email]
>  For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: How to display the classpath that Ant is using to launch the java task?

Rainer Noack
In reply to this post by fjanon
maybe

http://enitsys.sourceforge.net/ant-classloadertask/

can help you.

cheers

rainer

-----Urspr√ľngliche Nachricht-----
Von: Fred Janon [mailto:[hidden email]]
Gesendet: Mittwoch, 27. Februar 2008 03:39
An: [hidden email]
Betreff: How to display the classpath that Ant is using to launch the java
task?

Is there anything to display the classpath that Ant is using to launch
a java task besides the verbose and debug ant options that don't
display it?

How can I debug Ant file in general? I check the Ant manual left and
right and didn't find anything.

Thanks

Fred


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display the classpath that Ant is using to launch the java task?

fjanon
In reply to this post by Garrett-3
Hi Garrett,

Thanks for the answer, the TopAntTips got the ansmwer for my problem.

Following up on my ant java target question, the "fork" option for
those who use ant to run java apps seem to be important when specifying
the classpath:

with fork='true' in the java target, here is the classpath as seen from
the app, it is the one from "app.classpath" in the build file as
desired:

     [java]
C:\Groovy-1.5.4\embeddable\groovy-all-1.5.4.jar;C:\Groovy_JPADownstream\classes;C:\Groovy_JPADownstream\lib\derby.jar;C:\Groovy_JPADownstr
eam\lib\derbyclient.jar;C:\Groovy_JPADownstream\lib\toplink-essentials-agent.jar;C:\Groovy_JPADownstream\lib\toplink-essentials.jar;C:\Groovy_JPADowns
tream\config

  <target name = "run" depends = "compile">
  <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise the
classpath of the application is the one from ant and JPA doesn't find
the persistence.xml file -->
    <java classname = "downstream.PopulateDownstream" fork="true">
        <classpath refid = "app.classpath"/>
    </java>
  </target>

with fork='false' in the java target. it is the one for "ant", not much
to do with the one specified in "app.classpath" in the build file:

     [java]
C:\ant-1.7.0\lib\ant-launcher.jar;C:\Groovy_JPADownstream\.;C:\Program
Files\Java\jre1.6.0_02\lib\ext\QTJava.zip;C:\ant-1.7.0\lib\ant-antl
r.jar;C:\ant-1.7.0\lib\ant-apache-bcel.jar;C:\ant-1.7.0\lib\ant-apache-bsf.jar;C:\ant-1.7.0\lib\ant-apache-log4j.jar;C:\ant-1.7.0\lib\ant-apache-oro.j
ar;C:\ant-1.7.0\lib\ant-apache-regexp.jar;C:\ant-1.7.0\lib\ant-apache-resolver.jar;C:\ant-1.7.0\lib\ant-commons-logging.jar;C:\ant-1.7.0\lib\ant-commo
ns-net.jar;C:\ant-1.7.0\lib\ant-jai.jar;C:\ant-1.7.0\lib\ant-javamail.jar;C:\ant-1.7.0\lib\ant-jdepend.jar;C:\ant-1.7.0\lib\ant-jmf.jar;C:\ant-1.7.0\l
ib\ant-jsch.jar;C:\ant-1.7.0\lib\ant-junit.jar;C:\ant-1.7.0\lib\ant-launcher.jar;C:\ant-1.7.0\lib\ant-netrexx.jar;C:\ant-1.7.0\lib\ant-nodeps.jar;C:\a
nt-1.7.0\lib\ant-starteam.jar;C:\ant-1.7.0\lib\ant-stylebook.jar;C:\ant-1.7.0\lib\ant-swing.jar;C:\ant-1.7.0\lib\ant-testutil.jar;C:\ant-1.7.0\lib\ant
-trax.jar;C:\ant-1.7.0\lib\ant-weblogic.jar;C:\ant-1.7.0\lib\ant.jar;C:\ant-1.7.0\lib\junit.jar;C:\ant-1.7.0\lib\xercesImpl.jar;C:\ant-1.7.0\lib\xml-a
pis.jar;C:\jdk1.6.0_02\lib\tools.jar

  <target name = "run" depends = "compile">
  <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise the
classpath of the application is the one from ant and JPA doesn't find
the persistence.xml file -->
    <java classname = "downstream.PopulateDownstream" fork="false">
        <classpath refid = "app.classpath"/>
    </java>
  </target>

I don't really understand why for='true' is not the default for the
java target in ant but that's how it is.

Conclusion: make sure that 'fork="true"' is set on a java target in Ant
is you want to use your own classpath and not the Ant one.

Fred

--- Garrett Smith <[hidden email]> wrote:

> On Tue, Feb 26, 2008 at 6:38 PM, Fred Janon <[hidden email]> wrote:
> > Is there anything to display the classpath that Ant is using to
> launch
> >  a java task besides the verbose and debug ant options that don't
> >  display it?
> >
> This might not be the answer to what you want to do, but...
>
> Ant should be using PATH, variable.
>
> Are you using Windows? If so...
> Start -> Control Panel...
> Double click on "System"...
> In the System Properties, choose "Advanced" tab.
> Click "Environment Variables" button
> set system properties.
>
> If JAVA_HOME is in "Program Files", change that to
> C:\Progra~1\Java\...
>
> I know it's not exactly what you asked, but thought it might help
> anyway.
>
> This might help, too:
> http://www.catalysoft.com/articles/TopAntTips.html
>
> Garrett
>
> >  How can I debug Ant file in general? I check the Ant manual left
> and
> >  right and didn't find anything.
> >
> >  Thanks
> >
> >  Fred
> >
> >
> >
> ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: [hidden email]
> >  For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display the classpath that Ant is using to launch the java task?

Steve Loughran
Fred Janon wrote:

> Hi Garrett,
>
> Thanks for the answer, the TopAntTips got the ansmwer for my problem.
>
> Following up on my ant java target question, the "fork" option for
> those who use ant to run java apps seem to be important when specifying
> the classpath:
>
> with fork='true' in the java target, here is the classpath as seen from
> the app, it is the one from "app.classpath" in the build file as
> desired:
>
>      [java]
> C:\Groovy-1.5.4\embeddable\groovy-all-1.5.4.jar;C:\Groovy_JPADownstream\classes;C:\Groovy_JPADownstream\lib\derby.jar;C:\Groovy_JPADownstr
> eam\lib\derbyclient.jar;C:\Groovy_JPADownstream\lib\toplink-essentials-agent.jar;C:\Groovy_JPADownstream\lib\toplink-essentials.jar;C:\Groovy_JPADowns
> tream\config
>
>   <target name = "run" depends = "compile">
>   <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise the
> classpath of the application is the one from ant and JPA doesn't find
> the persistence.xml file -->
>     <java classname = "downstream.PopulateDownstream" fork="true">
>         <classpath refid = "app.classpath"/>
>     </java>
>   </target>
>
> with fork='false' in the java target. it is the one for "ant", not much
> to do with the one specified in "app.classpath" in the build file:
>
>      [java]
> C:\ant-1.7.0\lib\ant-launcher.jar;C:\Groovy_JPADownstream\.;C:\Program
> Files\Java\jre1.6.0_02\lib\ext\QTJava.zip;C:\ant-1.7.0\lib\ant-antl
> r.jar;C:\ant-1.7.0\lib\ant-apache-bcel.jar;C:\ant-1.7.0\lib\ant-apache-bsf.jar;C:\ant-1.7.0\lib\ant-apache-log4j.jar;C:\ant-1.7.0\lib\ant-apache-oro.j
> ar;C:\ant-1.7.0\lib\ant-apache-regexp.jar;C:\ant-1.7.0\lib\ant-apache-resolver.jar;C:\ant-1.7.0\lib\ant-commons-logging.jar;C:\ant-1.7.0\lib\ant-commo
> ns-net.jar;C:\ant-1.7.0\lib\ant-jai.jar;C:\ant-1.7.0\lib\ant-javamail.jar;C:\ant-1.7.0\lib\ant-jdepend.jar;C:\ant-1.7.0\lib\ant-jmf.jar;C:\ant-1.7.0\l
> ib\ant-jsch.jar;C:\ant-1.7.0\lib\ant-junit.jar;C:\ant-1.7.0\lib\ant-launcher.jar;C:\ant-1.7.0\lib\ant-netrexx.jar;C:\ant-1.7.0\lib\ant-nodeps.jar;C:\a
> nt-1.7.0\lib\ant-starteam.jar;C:\ant-1.7.0\lib\ant-stylebook.jar;C:\ant-1.7.0\lib\ant-swing.jar;C:\ant-1.7.0\lib\ant-testutil.jar;C:\ant-1.7.0\lib\ant
> -trax.jar;C:\ant-1.7.0\lib\ant-weblogic.jar;C:\ant-1.7.0\lib\ant.jar;C:\ant-1.7.0\lib\junit.jar;C:\ant-1.7.0\lib\xercesImpl.jar;C:\ant-1.7.0\lib\xml-a
> pis.jar;C:\jdk1.6.0_02\lib\tools.jar
>
>   <target name = "run" depends = "compile">
>   <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise the
> classpath of the application is the one from ant and JPA doesn't find
> the persistence.xml file -->
>     <java classname = "downstream.PopulateDownstream" fork="false">
>         <classpath refid = "app.classpath"/>
>     </java>
>   </target>
>


When you don't fork, the classpath of the java process should be
  -the classpath you set
  -java.*, javax.* and some bits of org.omg.*, org.w3c.*  sun.* that are
part of the de-facto JVM API.
If the ant stuff is being seen, it could be that the app.classpath has
somehow pulled them in.
Your code runs under a security manager that catches calls to
System.exit(), so only your app exits, not the JVM.

 > I don't really understand why for='true' is not the default for the
 > java target in ant but that's how it is.


Historically, because it made things faster to run. Most of Ant's own
tasks <javac> etc. are bits of java code running in-JVM. Also, in-JVM
code picks up ANT's proxy and memory settings automatically; makes
customisation easier.

 > Conclusion: make sure that 'fork="true"' is set on a java target in Ant
 > is you want to use your own classpath and not the Ant one.

--
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to display the classpath that Ant is using to launch the java task?

fjanon
Hi Steve,

Thanks for the explanation. It still would save some head scratching
and $$$ (I spent almost a whole day trying to get my ant file running)
if the fork option documentation was a bit expanded.

Cheers,

Fred

--- Steve Loughran <[hidden email]> wrote:

> Fred Janon wrote:
> > Hi Garrett,
> >
> > Thanks for the answer, the TopAntTips got the ansmwer for my
> problem.
> >
> > Following up on my ant java target question, the "fork" option for
> > those who use ant to run java apps seem to be important when
> specifying
> > the classpath:
> >
> > with fork='true' in the java target, here is the classpath as seen
> from
> > the app, it is the one from "app.classpath" in the build file as
> > desired:
> >
> >      [java]
> >
>
C:\Groovy-1.5.4\embeddable\groovy-all-1.5.4.jar;C:\Groovy_JPADownstream\classes;C:\Groovy_JPADownstream\lib\derby.jar;C:\Groovy_JPADownstr
> >
>
eam\lib\derbyclient.jar;C:\Groovy_JPADownstream\lib\toplink-essentials-agent.jar;C:\Groovy_JPADownstream\lib\toplink-essentials.jar;C:\Groovy_JPADowns

> > tream\config
> >
> >   <target name = "run" depends = "compile">
> >   <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise
> the
> > classpath of the application is the one from ant and JPA doesn't
> find
> > the persistence.xml file -->
> >     <java classname = "downstream.PopulateDownstream" fork="true">
> >         <classpath refid = "app.classpath"/>
> >     </java>
> >   </target>
> >
> > with fork='false' in the java target. it is the one for "ant", not
> much
> > to do with the one specified in "app.classpath" in the build file:
> >
> >      [java]
> >
>
C:\ant-1.7.0\lib\ant-launcher.jar;C:\Groovy_JPADownstream\.;C:\Program
> > Files\Java\jre1.6.0_02\lib\ext\QTJava.zip;C:\ant-1.7.0\lib\ant-antl
> >
>
r.jar;C:\ant-1.7.0\lib\ant-apache-bcel.jar;C:\ant-1.7.0\lib\ant-apache-bsf.jar;C:\ant-1.7.0\lib\ant-apache-log4j.jar;C:\ant-1.7.0\lib\ant-apache-oro.j
> >
>
ar;C:\ant-1.7.0\lib\ant-apache-regexp.jar;C:\ant-1.7.0\lib\ant-apache-resolver.jar;C:\ant-1.7.0\lib\ant-commons-logging.jar;C:\ant-1.7.0\lib\ant-commo
> >
>
ns-net.jar;C:\ant-1.7.0\lib\ant-jai.jar;C:\ant-1.7.0\lib\ant-javamail.jar;C:\ant-1.7.0\lib\ant-jdepend.jar;C:\ant-1.7.0\lib\ant-jmf.jar;C:\ant-1.7.0\l
> >
>
ib\ant-jsch.jar;C:\ant-1.7.0\lib\ant-junit.jar;C:\ant-1.7.0\lib\ant-launcher.jar;C:\ant-1.7.0\lib\ant-netrexx.jar;C:\ant-1.7.0\lib\ant-nodeps.jar;C:\a
> >
>
nt-1.7.0\lib\ant-starteam.jar;C:\ant-1.7.0\lib\ant-stylebook.jar;C:\ant-1.7.0\lib\ant-swing.jar;C:\ant-1.7.0\lib\ant-testutil.jar;C:\ant-1.7.0\lib\ant
> >
>
-trax.jar;C:\ant-1.7.0\lib\ant-weblogic.jar;C:\ant-1.7.0\lib\ant.jar;C:\ant-1.7.0\lib\junit.jar;C:\ant-1.7.0\lib\xercesImpl.jar;C:\ant-1.7.0\lib\xml-a

> > pis.jar;C:\jdk1.6.0_02\lib\tools.jar
> >
> >   <target name = "run" depends = "compile">
> >   <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise
> the
> > classpath of the application is the one from ant and JPA doesn't
> find
> > the persistence.xml file -->
> >     <java classname = "downstream.PopulateDownstream" fork="false">
> >         <classpath refid = "app.classpath"/>
> >     </java>
> >   </target>
> >
>
>
> When you don't fork, the classpath of the java process should be
>   -the classpath you set
>   -java.*, javax.* and some bits of org.omg.*, org.w3c.*  sun.* that
> are
> part of the de-facto JVM API.
> If the ant stuff is being seen, it could be that the app.classpath
> has
> somehow pulled them in.
> Your code runs under a security manager that catches calls to
> System.exit(), so only your app exits, not the JVM.
>
>  > I don't really understand why for='true' is not the default for
> the
>  > java target in ant but that's how it is.
>
>
> Historically, because it made things faster to run. Most of Ant's own
>
> tasks <javac> etc. are bits of java code running in-JVM. Also, in-JVM
>
> code picks up ANT's proxy and memory settings automatically; makes
> customisation easier.
>
>  > Conclusion: make sure that 'fork="true"' is set on a java target
> in Ant
>  > is you want to use your own classpath and not the Ant one.
>
> --
> Steve Loughran                
> http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...