ANT: Verify Classpath

Discussion in 'Java' started by Prabh, May 8, 2004.

  1. Prabh

    Prabh Guest

    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
     
    Prabh, May 8, 2004
    #1
    1. Advertising

  2. Prabh wrote:

    > 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
     
    =?ISO-8859-15?Q?G=E9din_Fr=E9d=E9ric?=, May 8, 2004
    #2
    1. Advertising

  3. Prabh

    Tony Morris Guest

    Re: Verify Classpath

    "Prabh" <> wrote in message
    news:...
    > 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)
     
    Tony Morris, May 8, 2004
    #3
  4. Prabh

    Prabh Guest

    > 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
     
    Prabh, May 8, 2004
    #4
  5. Prabh

    Tony Morris Guest

    > I tried, <echo message = "CLASSPATH = ${classpath}" />
    > 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)
     
    Tony Morris, May 8, 2004
    #5
  6. Prabh wrote:

    >> 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
     
    =?ISO-8859-15?Q?G=E9din_Fr=E9d=E9ric?=, May 9, 2004
    #6
  7. Prabh

    Tony Morris Guest

    > 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)
     
    Tony Morris, May 9, 2004
    #7
  8. Prabh

    bshubh_82

    Joined:
    Sep 26, 2007
    Messages:
    1
    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>
     
    bshubh_82, Sep 26, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ronald Fischer

    Ant javac : How to print classpath?

    Ronald Fischer, Sep 18, 2003, in forum: Java
    Replies:
    1
    Views:
    17,624
    Wayne Berke
    Sep 19, 2003
  2. Flip
    Replies:
    3
    Views:
    7,324
    Tony Morris
    Feb 9, 2004
  3. Gabe
    Replies:
    3
    Views:
    1,089
  4. Replies:
    2
    Views:
    768
  5. Replies:
    2
    Views:
    1,122
    Mike Schilling
    Mar 2, 2008
Loading...

Share This Page