Grokbase Groups Ant user May 2009
FAQ
Hello Everyone,

I am running ANT programmatically in JAVA. So, my task is to build the
BUILD.XML.
I'm able to do so, but it throws an exception saying:

/scratch2/nemer/test/xfire/build.xml:5: The following error occurred while
executing this line:
/scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/opt/jdk1.6.0_06/jre"

But in the end it says: BUILD SUCCESSFUL (but it still throws that
exception).

I already set all of my environment variables to /opt/jdk1.6.0_06/
(JAVA_HOME and also in PATH), which is a JDK! And even on the error message
it says that the java is set to /opt/jdk1.6.0_06/jre (which is a JDK, I
don't know where it gets the jre from).

So, does any one know how can I solve this problem? Is there a configuration
file in ANT that we need to set up! I'm stuck there!!

I'm running the ant 1.7.1.

Cheers,
--
David Nemer
Sent from Saarbrucken, SL, Germany

Search Discussions

  • Cole, Derek E at May 14, 2009 at 1:47 pm
    So, I searched the internet for days trying to find out how to do this,
    and never could find a straight answer. If you or anyone else has a
    better way to do this, let me know, but I found two ways to make this
    work.

    The first way is to use the AntClassLoader API. I set up a Boolean true,
    a null path, and used

    AntClassLoader ACL = new AntClassLoader(antproject, path, true);

    Which says to use the system classloader, and anything additional in the
    path (which I didn't put anything it). This seems to have worked.

    The next idea is to set the external compiler property to true.

    Hope this helps

    Derek

    -----Original Message-----
    From: David Nemer
    Sent: Thursday, May 14, 2009 8:15 AM
    To: Ant Users List
    Subject: Java in JDK but ANT can't find it!

    Hello Everyone,

    I am running ANT programmatically in JAVA. So, my task is to build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Ashley Williams at May 14, 2009 at 1:57 pm
    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk directory
    instead,

    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,

    I am running ANT programmatically in JAVA. So, my task is to build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Cole, Derek E at May 14, 2009 at 2:29 pm
    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk directory
    instead,

    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,

    I am running ANT programmatically in JAVA. So, my task is to build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 14, 2009 at 2:33 pm
    Thank you Derek, I will try to use your idea and Ill give you a feedback!

    And yes, you are right, even though everything is set up, the JAVA_HOME, for
    the JDK directory, ANT still doesn't seem to find the correct path, I have
    no idea why does this JRE appears, since it is not mentioned before in any
    PATH or JAVA_HOME

    Cheers
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Thu, May 14, 2009 at 4:28 PM, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk directory
    instead,

    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,

    I am running ANT programmatically in JAVA. So, my task is to build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Ashley Williams at May 14, 2009 at 2:43 pm
    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead


    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk directory
    instead,

    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,

    I am running ANT programmatically in JAVA. So, my task is to build
    the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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


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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 14, 2009 at 2:47 pm
    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also check with
    echo $JAVA_HOME and which java, they all tell the right path, but not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,
    I am running ANT programmatically in JAVA. So, my task is to build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Ashley Williams at May 14, 2009 at 2:55 pm
    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.
    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,
    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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


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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 14, 2009 at 3:02 pm
    Ashley, you're acting just like ANT, I tell you something, but you don't
    seem to believe me!! ;-)

    Here is a piece of my batch file:

    14 export JAVA_HOME=/opt/jdk1.6.0_06
    15 export M2_HOME=/opt/maven-2.0.7
    16
    17
    18
    19 export ANT_HOME=/home/nemer/apache-ant-1.7.1
    20 export PATH=${JAVA_HOME}/bin:${JAVA_HOME}/lib:${PATH}:

    And here are the commands:

    nemer@kubrick:~$ which java
    /opt/jdk1.6.0_06/bin/java
    nemer@kubrick:~$ echo $JAVA_HOME
    /opt/jdk1.6.0_06

    Do you believe on me now?? Besides checking the PATH which I did, do you
    have any other suggestions?

    Cheers
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Thu, May 14, 2009 at 4:54 PM, Ashley Williams wrote:

    Check your PATH to make sure you are launching your application from the
    jdk and not the jre.

    I launch programatically and I don't get these errors with the same version
    of ant so it does
    sound as if the problem lies outside of ant.


    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also check with
    echo $JAVA_HOME and which java, they all tell the right path, but not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre
    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,
    I am running ANT programmatically in JAVA. So, my task is to build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org


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

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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Ashley Williams at May 14, 2009 at 3:10 pm
    Hi David,

    Yeah sorry to sound so belligerent! It's just that this definitely
    works on
    my own system with the same version of ant and I often get tripped up
    by my own carefully crafted batch files.

    So I'm just trying to establish what is certain and what is not. I've
    just checked
    with the source code and found this:

    From CompilerAdapterFactory.java:

    throw new BuildException("Unable to find a
    javac "
    + "compiler;\n"
    + MODERN_COMPILER
    + " is not on the "
    + "classpath.\n"
    + "Perhaps JAVA_HOME
    does not"
    + " point to the JDK.
    \n"
    + "It is currently set to \""
    + JavaEnvUtils.getJavaHome()
    + "\"");

    From JavaUtils.java:

    private static final String JAVA_HOME =
    System.getProperty("java.home");
    public static String getJavaHome() {
    return JAVA_HOME;
    }

    So it looks as though java.home is definitely being reported rather than
    /jre being appended to the output string. Maybe start investigating
    from there.

    - Ashley
    On 14 May 2009, at 16:01, David Nemer wrote:

    Ashley, you're acting just like ANT, I tell you something, but you
    don't
    seem to believe me!! ;-)

    Here is a piece of my batch file:

    14 export JAVA_HOME=/opt/jdk1.6.0_06
    15 export M2_HOME=/opt/maven-2.0.7
    16
    17
    18
    19 export ANT_HOME=/home/nemer/apache-ant-1.7.1
    20 export PATH=${JAVA_HOME}/bin:${JAVA_HOME}/lib:${PATH}:

    And here are the commands:

    nemer@kubrick:~$ which java
    /opt/jdk1.6.0_06/bin/java
    nemer@kubrick:~$ echo $JAVA_HOME
    /opt/jdk1.6.0_06

    Do you believe on me now?? Besides checking the PATH which I did, do
    you
    have any other suggestions?

    Cheers
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Thu, May 14, 2009 at 4:54 PM, Ashley Williams wrote:

    Check your PATH to make sure you are launching your application
    from the
    jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version
    of ant so it does
    sound as if the problem lies outside of ant.


    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre
    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was
    set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,
    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find
    a javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws
    that
    exception).

    I already set all of my environment variables to /opt/
    jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the
    error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org


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

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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Kevin Jackson at May 18, 2009 at 7:31 pm
    Hi,

    what does
    which javac

    tell you?

    And can you post the output of ant -verbose?

    Thanks,
    Kev

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 18, 2009 at 8:19 pm
    Hey Guys, thank you all for your help, I'm answering the questions from
    Ashley, Steve and Kevin, some answers are huge due to the compilation
    message ANT provides. Just a reminder, I'm running ANT in a Linux Server, my
    overall goal is to download a version from a repository, build the version,
    and report to a mySql database whether it built or not, if not, mention the
    reason. All that in JAVA.

    *1. Ashley, I'm running my stuff in a Linux server*
    *
    2. Steve: is this a package-manager installation of Ant?*
    I'm not sure. I just downloaded the bin files from the Ant webpage and
    installed it.

    *3. What does ant -diagnostics say?*
    nemer@kubrick:~$ ant -diagnostics
    ------- Ant diagnostics report -------
    Apache Ant version 1.7.1 compiled on June 27 2008

    -------------------------------------------
    Implementation Version
    -------------------------------------------
    core tasks : 1.7.1
    optional tasks : not available

    -------------------------------------------
    ANT PROPERTIES
    -------------------------------------------
    ant.version: Apache Ant version 1.7.1 compiled on June 27 2008
    ant.java.version: 1.6
    ant.core.lib: /home/nemer/apache-ant-1.7.1/lib/ant.jar
    ant.home: /home/nemer/apache-ant-1.7.1

    -------------------------------------------
    ANT_HOME/lib jar listing
    -------------------------------------------
    ant.home: /home/nemer/apache-ant-1.7.1
    ant-jai.jar (21348 bytes)
    ant-jdepend.jar (8132 bytes)
    ant-nodeps.jar (431580 bytes)
    ant-testutil.jar (14941 bytes)
    ant-apache-bsf.jar (3939 bytes)
    ant-jsch.jar (30797 bytes)
    ant-apache-regexp.jar (3762 bytes)
    ant-swing.jar (6738 bytes)
    ant-commons-net.jar (47026 bytes)
    ant-apache-bcel.jar (8611 bytes)
    xercesImpl.jar (1223877 bytes)
    ant-apache-oro.jar (39627 bytes)
    ant-starteam.jar (35355 bytes)
    ant-commons-logging.jar (3910 bytes)
    ant-weblogic.jar (14205 bytes)
    ant-stylebook.jar (2330 bytes)
    ant-apache-log4j.jar (3056 bytes)
    xml-apis.jar (194354 bytes)
    ant-junit.jar (93518 bytes)
    ant-apache-resolver.jar (4071 bytes)
    ant-antlr.jar (5752 bytes)
    ant.jar (1323005 bytes)
    ant-javamail.jar (6998 bytes)
    ant-launcher.jar (12143 bytes)
    ant-jmf.jar (6593 bytes)
    ant-trax.jar (6881 bytes)
    ant-netrexx.jar (9881 bytes)

    -------------------------------------------
    USER_HOME/.ant/lib jar listing
    -------------------------------------------
    user.home: /home/nemer
    No such directory.

    -------------------------------------------
    Tasks availability
    -------------------------------------------
    image : Missing dependency javax.media.jai.PlanarImage
    sshexec : Missing dependency com.jcraft.jsch.UserInfo
    scp : Missing dependency com.jcraft.jsch.UserInfo
    jdepend : Missing dependency jdepend.xmlui.JDepend
    A task being missing/unavailable should only matter if you are trying to use
    it

    -------------------------------------------
    org.apache.env.Which diagnostics
    -------------------------------------------
    Not available.
    Download it at http://xml.apache.org/commons/

    -------------------------------------------
    XML Parser information
    -------------------------------------------
    XML Parser : org.apache.xerces.jaxp.SAXParserImpl
    XML Parser Location: /usr/share/java/xercesImpl.jar
    Namespace-aware parser : org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
    Namespace-aware parser Location: /usr/share/java/xercesImpl.jar

    -------------------------------------------
    System properties
    -------------------------------------------
    java.runtime.name : Java(TM) SE Runtime Environment
    sun.boot.library.path : /opt/jdk1.6.0_06/jre/lib/amd64
    java.vm.version : 10.0-b22
    ant.library.dir : /home/nemer/apache-ant-1.7.1/lib
    java.vm.vendor : Sun Microsystems Inc.
    java.vendor.url : http://java.sun.com/
    path.separator : :
    java.vm.name : Java HotSpot(TM) 64-Bit Server VM
    file.encoding.pkg : sun.io
    user.country : US
    sun.java.launcher : SUN_STANDARD
    sun.os.patch.level : unknown
    java.vm.specification.name : Java Virtual Machine Specification
    user.dir : /home/nemer
    java.runtime.version : 1.6.0_06-b02
    java.awt.graphicsenv : sun.awt.X11GraphicsEnvironment
    java.endorsed.dirs : /opt/jdk1.6.0_06/jre/lib/endorsed
    os.arch : amd64
    java.io.tmpdir : /tmp
    line.separator :

    java.vm.specification.vendor : Sun Microsystems Inc.
    os.name : Linux
    ant.home : /home/nemer/apache-ant-1.7.1
    sun.jnu.encoding : UTF-8
    java.library.path :
    /opt/jdk1.6.0_06/jre/lib/amd64/server:/opt/jdk1.6.0_06/jre/lib/amd64:/opt/jdk1.6.0_06/jre/../lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib
    java.specification.name : Java Platform API Specification
    java.class.version : 50.0
    sun.management.compiler : HotSpot 64-Bit Server Compiler
    os.version : 2.6.18-6-amd64
    user.home : /home/nemer
    user.timezone : Europe/Berlin
    java.awt.printerjob : sun.print.PSPrinterJob
    file.encoding : UTF-8
    java.specification.version : 1.6
    user.name : nemer
    java.class.path :
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/xercesImpl.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jai.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jdepend.jar:/home/nemer/apache-ant-1.7.1/lib/ant-nodeps.jar:/home/nemer/apache-ant-1.7.1/lib/ant-testutil.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-bsf.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jsch.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-regexp.jar:/home/nemer/apache-ant-1.7.1/lib/ant-swing.jar:/home/nemer/apache-ant-1.7.1/lib/ant-commons-net.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-bcel.jar:/home/nemer/apache-ant-1.7.1/lib/xercesImpl.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-oro.jar:/home/nemer/apache-ant-1.7.1/lib/ant-starteam.jar:/home/nemer/apache-ant-1.7.1/lib/ant-commons-logging.jar:/home/nemer/apache-ant-1.7.1/lib/ant-weblogic.jar:/home/nemer/apache-ant-1.7.1/lib/ant-stylebook.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-log4j.jar:/home/nemer/apache-ant-1.7.1/lib/xml-apis.jar:/home/nemer/apache-ant-1.7.1/lib/ant-junit.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-resolver.jar:/home/nemer/apache-ant-1.7.1/lib/ant-antlr.jar:/home/nemer/apache-ant-1.7.1/lib/ant.jar:/home/nemer/apache-ant-1.7.1/lib/ant-javamail.jar:/home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jmf.jar:/home/nemer/apache-ant-1.7.1/lib/ant-trax.jar:/home/nemer/apache-ant-1.7.1/lib/ant-netrexx.jar:/opt/jdk1.6.0_06/lib/tools.jar
    java.vm.specification.version : 1.0
    sun.arch.data.model : 64
    java.home : /opt/jdk1.6.0_06/jre
    java.specification.vendor : Sun Microsystems Inc.
    user.language : en
    java.vm.info : mixed mode
    java.version : 1.6.0_06
    java.ext.dirs : /opt/jdk1.6.0_06/jre/lib/ext:/usr/java/packages/lib/ext
    sun.boot.class.path :
    /opt/jdk1.6.0_06/jre/lib/resources.jar:/opt/jdk1.6.0_06/jre/lib/rt.jar:/opt/jdk1.6.0_06/jre/lib/sunrsasign.jar:/opt/jdk1.6.0_06/jre/lib/jsse.jar:/opt/jdk1.6.0_06/jre/lib/jce.jar:/opt/jdk1.6.0_06/jre/lib/charsets.jar:/opt/jdk1.6.0_06/jre/classes
    java.vendor : Sun Microsystems Inc.
    file.separator : /
    java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
    sun.cpu.endian : little
    sun.io.unicode.encoding : UnicodeLittle
    sun.cpu.isalist :

    -------------------------------------------
    Temp dir
    -------------------------------------------
    Temp dir is /tmp
    Temp dir is writeable
    Temp dir alignment with system clock is -767 ms

    -------------------------------------------
    Locale information
    -------------------------------------------
    Timezone Central European Time offset=7200000

    -------------------------------------------
    Proxy information
    -------------------------------------------
    Java1.5+ proxy settings:
    Direct connection

    *4. Kevin: what does which javac?*
    It says "/opt/jdk1.6.0_06/bin/javac" that is the right java path.

    *5. And can you post the output of ant -verbose?*
    This is the last lines i could copy:

    [javac] org/codehaus/xfire/transport/http/XFireConfigurableServlet.java
    added as org/codehaus/xfire/transport/http/XFireConfigurableServlet.class
    doesn't exist.
    [javac] Compiling 28 source files to
    /scratch2/nemer/test/xfire/xfire-spring/target/classes
    [javac] Using modern compiler
    [javac] Compilation arguments:
    [javac] '-deprecation'
    [javac] '-d'
    [javac] '/scratch2/nemer/test/xfire/xfire-spring/target/classes'
    [javac] '-classpath'
    [javac]
    '/scratch2/nemer/test/xfire/xfire-spring/target/classes:/scratch2/nemer/test/xfire/xfire-spring/target/lib/annogen-0.1.0.jar:/scratch2/nemer/test/xfire/xfire-spring/target/lib/commons-beanutils-1.7.0.jar:/scratch2/nemer/test/xfire/xfire-spring/target/lib/nekohtml-0.9.5.jar:/scratch2/nemer/test/xfire/xfire-spring/target/lib/qdox-1.5.jar:/scratch2/nemer/test/xfire/xfire-spring/target/lib/spring-1.2.6.jar:/scratch2/nemer/test/xfire/xfire-spring/target/lib/spring-mock-1.2.6.jar:/scratch2/nemer/test/xfire/xfire-spring/target/lib/xbean-spring-2.3.jar:/scratch2/nemer/test/xfire/lib/javamail-1.3.2.jar:/scratch2/nemer/test/xfire/target/lib/commons-codec-1.3.jar:/scratch2/nemer/test/xfire/target/lib/commons-httpclient-3.0.jar:/scratch2/nemer/test/xfire/target/lib/commons-logging-1.0.4.jar:/scratch2/nemer/test/xfire/target/lib/easymock-1.1.jar:/scratch2/nemer/test/xfire/target/lib/geronimo-spec-activation-1.0.2-rc4.jar:/scratch2/nemer/test/xfire/target/lib/httpunit-1.6.1.jar:/scratch2/nemer/test/xfire/target/lib/jaxen-1.1-beta-8.jar:/scratch2/nemer/test/xfire/target/lib/jdom-1.0.jar:/scratch2/nemer/test/xfire/target/lib/junit-3.8.1.jar:/scratch2/nemer/test/xfire/target/lib/servletapi-2.3.jar:/scratch2/nemer/test/xfire/target/lib/stax-1.1.2-dev.jar:/scratch2/nemer/test/xfire/target/lib/stax-api-1.0.jar:/scratch2/nemer/test/xfire/target/lib/wsdl4j-1.5.2.jar:/scratch2/nemer/test/xfire/target/lib/wstx-asl-2.9.jar:/scratch2/nemer/test/xfire/target/lib/xmlunit-1.0.jar:/scratch2/nemer/test/xfire/xfire-aegis/target/xfire-aegis-1.2-SNAPSHOT.jar:/scratch2/nemer/test/xfire/xfire-annotations/target/xfire-annotations-1.2-SNAPSHOT.jar:/scratch2/nemer/test/xfire/xfire-core/target/xfire-core-1.2-SNAPSHOT.jar:/scratch2/nemer/test/xfire/xfire-xmlbeans/target/xfire-xmlbeans-1.2-SNAPSHOT.jar:/home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/xercesImpl.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jai.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jdepend.jar:/home/nemer/apache-ant-1.7.1/lib/ant-nodeps.jar:/home/nemer/apache-ant-1.7.1/lib/ant-testutil.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-bsf.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jsch.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-regexp.jar:/home/nemer/apache-ant-1.7.1/lib/ant-swing.jar:/home/nemer/apache-ant-1.7.1/lib/ant-commons-net.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-bcel.jar:/home/nemer/apache-ant-1.7.1/lib/xercesImpl.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-oro.jar:/home/nemer/apache-ant-1.7.1/lib/ant-starteam.jar:/home/nemer/apache-ant-1.7.1/lib/ant-commons-logging.jar:/home/nemer/apache-ant-1.7.1/lib/ant-weblogic.jar:/home/nemer/apache-ant-1.7.1/lib/ant-stylebook.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-log4j.jar:/home/nemer/apache-ant-1.7.1/lib/xml-apis.jar:/home/nemer/apache-ant-1.7.1/lib/ant-junit.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-resolver.jar:/home/nemer/apache-ant-1.7.1/lib/ant-antlr.jar:/home/nemer/apache-ant-1.7.1/lib/ant.jar:/home/nemer/apache-ant-1.7.1/lib/ant-javamail.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jmf.jar:/home/nemer/apache-ant-1.7.1/lib/ant-trax.jar:/home/nemer/apache-ant-1.7.1/lib/ant-netrexx.jar:/opt/jdk1.6.0_06/lib/tools.jar'
    [javac] '-sourcepath'
    [javac] '/scratch2/nemer/test/xfire/xfire-spring/src/main'
    [javac] '-target'
    [javac] '1.4'
    [javac] '-g'
    [javac] '-source'
    [javac] '1.4'
    [javac]
    [javac] The ' characters around the executable and arguments are
    [javac] not part of the command.
    [javac] Files to be compiled:
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/AbstractXFireSpringTest.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/GenericApplicationContext.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/Jsr181BeanPostProcessor.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/ServiceBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/SpringUtils.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/WebConfigLoader.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/XFireConfigLoader.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/XFireSpringServlet.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/AbstractSoapBindingBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/EndpointBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/HandlerFactory.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/HandlerNameBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/MethodBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/ParameterBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/SchemaBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/ServiceFactoryBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/Soap11BindingBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/Soap12BindingBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/SpringServiceConfiguration.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/config/XFireBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/editors/ServiceFactoryEditor.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/remoting/Jsr181HandlerMapping.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/remoting/XFireClientFactoryBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/remoting/XFireClientInterceptor.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/remoting/XFireExporter.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/remoting/XFireProxyFactoryBean.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/remoting/XFireServletControllerAdapter.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/transport/http/XFireConfigurableServlet.java
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/XFireConfigLoader.java:9:
    cannot find symbol
    [javac] symbol : class XBeanHelper
    [javac] location: package org.apache.xbean.spring.context.impl
    [javac] import org.apache.xbean.spring.context.impl.XBeanHelper;
    [javac] ^
    [javac]
    /scratch2/nemer/test/xfire/xfire-spring/src/main/org/codehaus/xfire/spring/XFireConfigLoader.java:73:
    cannot find symbol
    [javac] symbol : variable XBeanHelper
    [javac] location: class org.codehaus.xfire.spring.XFireConfigLoader
    [javac] XmlBeanDefinitionReader xmlReader =
    XBeanHelper.createBeanDefinitionReader((SpringApplicationContext) ctx,
    [javac] ^
    [javac] 2 errors
    [ant] Exiting /scratch2/nemer/test/xfire/xfire-spring/build.xml.

    BUILD FAILED
    /scratch2/nemer/test/xfire/build.xml:14: The following error occurred while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Compile failed; see the
    compiler error output for details.
    at
    org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
    at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at
    org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at
    org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.Main.runBuild(Main.java:758)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
    Caused by: /scratch2/nemer/test/xfire/build-common.xml:81: Compile failed;
    see the compiler error output for details.
    at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1079)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
    at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at
    org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at
    org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
    ... 16 more
    --- Nested Exception ---
    /scratch2/nemer/test/xfire/build-common.xml:81: Compile failed; see the
    compiler error output for details.
    at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1079)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
    at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at
    org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at
    org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
    at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at
    org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at
    org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.Main.runBuild(Main.java:758)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

    Total time: 3 minutes 24 seconds
    nemer@kubrick:/scratch2/nemer/test/xfire$



    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Mon, May 18, 2009 at 9:30 PM, Kevin Jackson wrote:

    Hi,

    what does
    which javac

    tell you?

    And can you post the output of ant -verbose?

    Thanks,
    Kev

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Steve Loughran at May 19, 2009 at 11:07 am

    David Nemer wrote:
    Hey Guys, thank you all for your help, I'm answering the questions from
    Ashley, Steve and Kevin, some answers are huge due to the compilation
    message ANT provides. Just a reminder, I'm running ANT in a Linux Server, my
    overall goal is to download a version from a repository, build the version,
    and report to a mySql database whether it built or not, if not, mention the
    reason. All that in JAVA.

    *1. Ashley, I'm running my stuff in a Linux server*
    *
    2. Steve: is this a package-manager installation of Ant?*
    I'm not sure. I just downloaded the bin files from the Ant webpage and
    installed it.

    That's a no then.

    >

    java.runtime.name : Java(TM) SE Runtime Environment
    sun.boot.library.path : /opt/jdk1.6.0_06/jre/lib/amd64
    OK, the JVM

    FWIW, I have JAVA_HOME on an x86_64 box set to
    /usr/java/jdk

    which is then a symlink to the JVM version I want to use -currently
    JRockit.
    java.vm.version : 10.0-b22
    ant.library.dir : /home/nemer/apache-ant-1.7.1/lib
    java.vm.vendor : Sun Microsystems Inc.
    java.vendor.url : http://java.sun.com/
    path.separator : :
    java.vm.name : Java HotSpot(TM) 64-Bit Server VM
    file.encoding.pkg : sun.io
    user.country : US
    sun.java.launcher : SUN_STANDARD
    sun.os.patch.level : unknown
    java.vm.specification.name : Java Virtual Machine Specification
    user.dir : /home/nemer
    java.runtime.version : 1.6.0_06-b02
    java.awt.graphicsenv : sun.awt.X11GraphicsEnvironment
    java.endorsed.dirs : /opt/jdk1.6.0_06/jre/lib/endorsed
    os.arch : amd64
    java.io.tmpdir : /tmp
    line.separator :

    java.vm.specification.vendor : Sun Microsystems Inc.
    os.name : Linux
    ant.home : /home/nemer/apache-ant-1.7.1
    sun.jnu.encoding : UTF-8
    java.library.path :
    /opt/jdk1.6.0_06/jre/lib/amd64/server:/opt/jdk1.6.0_06/jre/lib/amd64:/opt/jdk1.6.0_06/jre/../lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib
    java.specification.name : Java Platform API Specification
    java.class.version : 50.0
    sun.management.compiler : HotSpot 64-Bit Server Compiler
    os.version : 2.6.18-6-amd64
    user.home : /home/nemer
    user.timezone : Europe/Berlin
    java.awt.printerjob : sun.print.PSPrinterJob
    file.encoding : UTF-8
    java.specification.version : 1.6
    user.name : nemer
    java.class.path :
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/xercesImpl.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jai.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jdepend.jar:/home/nemer/apache-ant-1.7.1/lib/ant-nodeps.jar:/home/nemer/apache-ant-1.7.1/lib/ant-testutil.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-bsf.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jsch.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-regexp.jar:/home/nemer/apache-ant-1.7.1/lib/ant-swing.jar:/home/nemer/apache-ant-1.7.1/lib/ant-commons-net.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-bcel.jar:/home/nemer/apache-ant-1.7.1/lib/xercesImpl.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-oro.jar:/home/nemer/apache-ant-1.7.1/lib/ant-starteam.jar:/home/nemer/apache-ant-1.7.1/lib/ant-commons-logging.jar:/home/nemer/apache-ant-1.7.1/lib/ant-weblogic.jar:/home/nemer/apache-ant-1.7.1/lib/ant-stylebook.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-log4j.jar:/home/nemer/a
    pache-ant-1.7.1/lib/xml-apis.jar:/home/nemer/apache-ant-1.7.1/lib/ant-junit.jar:/home/nemer/apache-ant-1.7.1/lib/ant-apache-resolver.jar:/home/nemer/apache-ant-1.7.1/lib/ant-antlr.jar:/home/nemer/apache-ant-1.7.1/lib/ant.jar:/home/nemer/apache-ant-1.7.1/lib/ant-javamail.jar:/home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar:/home/nemer/apache-ant-1.7.1/lib/ant-jmf.jar:/home/nemer/apache-ant-1.7.1/lib/ant-trax.jar:/home/nemer/apache-ant-1.7.1/lib/ant-netrexx.jar:/opt/jdk1.6.0_06/lib/tools.jar

    so there's tools.jar on the CP
    java.vm.specification.version : 1.0
    sun.arch.data.model : 64
    java.home : /opt/jdk1.6.0_06/jre
    But here java.home has been forced into the jre.

    java.specification.vendor : Sun Microsystems Inc.
    user.language : en
    java.vm.info : mixed mode
    java.version : 1.6.0_06
    java.ext.dirs : /opt/jdk1.6.0_06/jre/lib/ext:/usr/java/packages/lib/ext
    sun.boot.class.path :
    /opt/jdk1.6.0_06/jre/lib/resources.jar:/opt/jdk1.6.0_06/jre/lib/rt.jar:/opt/jdk1.6.0_06/jre/lib/sunrsasign.jar:/opt/jdk1.6.0_06/jre/lib/jsse.jar:/opt/jdk1.6.0_06/jre/lib/jce.jar:/opt/jdk1.6.0_06/jre/lib/charsets.jar:/opt/jdk1.6.0_06/jre/classes
    java.vendor : Sun Microsystems Inc.
    file.separator : /
    java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
    sun.cpu.endian : little
    sun.io.unicode.encoding : UnicodeLittle
    sun.cpu.isalist :

    I'm confused here, and had a look at my settings to see what's up

    -------------------------------------------
    System properties
    -------------------------------------------
    java.vm.vendor.url.bug : http://support.bea.com
    java.runtime.name : Java(TM) SE Runtime Environment
    sun.boot.library.path : /usr/java/jrockit-1.6.0_02/jre/lib/amd64
    java.vm.version : R27.4.0-90-89592-1.6.0_02-20070928-1715-linux-x86_64
    ant.library.dir : /home/slo/Java/Apache/ant/lib
    java.vm.vendor : BEA Systems, Inc.
    java.vendor.url : http://www.bea.com/
    path.separator : :
    java.vm.name : BEA JRockit(R)
    file.encoding.pkg : sun.io
    user.country : GB
    sun.java.launcher : SUN_STANDARD
    sun.os.patch.level : unknown
    java.vm.vendor.url : http://www.bea.com/
    java.vm.specification.name : Java Virtual Machine Specification
    user.dir : /usr/java/jrockit-1.6.0_02
    java.runtime.version : 1.6.0_02-b05
    java.awt.graphicsenv : sun.awt.X11GraphicsEnvironment
    java.endorsed.dirs : /usr/java/jrockit-1.6.0_02/jre/lib/endorsed
    os.arch : amd64
    java.io.tmpdir : /tmp
    line.separator :

    java.vm.specification.vendor : Sun Microsystems Inc.
    https.proxyHost : web-proxy
    os.name : Linux
    ant.home : /home/slo/Java/Apache/ant
    sun.jnu.encoding : UTF-8
    java.library.path :
    /usr/java/jrockit-1.6.0_02/jre/lib/amd64/jrockit:/usr/java/jrockit-1.6.0_02/jre/lib/amd64:/usr/java/jrockit-1.6.0_02/jre/../lib/amd64
    http.proxyPort : 8088
    java.specification.name : Java Platform API Specification
    java.class.version : 50.0
    sun.management.compiler : BEA JRockit(R) Optimizing Compiler
    os.version : 2.6.27-14-generic
    user.home : /home/slo
    user.timezone : GB
    java.awt.printerjob : sun.print.PSPrinterJob
    java.specification.version : 1.6
    file.encoding : UTF-8
    user.name : slo
    java.class.path : (all the ant stuff and then)
    :/usr/java/jrockit-1.6.0_02/lib/tools.jar
    java.vm.specification.version : 1.0
    sun.arch.data.model : 64
    java.home : /usr/java/jrockit-1.6.0_02/jre
    java.specification.vendor : Sun Microsystems Inc.
    user.language : en
    java.vm.info : compiled mode
    java.version : 1.6.0_02
    java.ext.dirs : /usr/java/jrockit-1.6.0_02/jre/lib/ext
    sun.boot.class.path :
    /usr/java/jrockit-1.6.0_02/jre/lib/amd64/jrockit/jrockit1.6.0.jar:/usr/java/jrockit-1.6.0_02/jre/lib/amd64/jrockit/jmapi.jar:/usr/java/jrockit-1.6.0_02/jre/lib/amd64/jrockit/jmxmapi.jar:/usr/java/jrockit-1.6.0_02/jre/lib/amd64/jrockit/rmp.jar:/usr/java/jrockit-1.6.0_02/jre/lib/amd64/jrockit/latency.jar:/usr/java/jrockit-1.6.0_02/jre/lib/resources.jar:/usr/java/jrockit-1.6.0_02/jre/lib/rt.jar:/usr/java/jrockit-1.6.0_02/jre/lib/sunrsasign.jar:/usr/java/jrockit-1.6.0_02/jre/lib/jsse.jar:/usr/java/jrockit-1.6.0_02/jre/lib/jce.jar:/usr/java/jrockit-1.6.0_02/jre/lib/charsets.jar:/usr/java/jrockit-1.6.0_02/jre/classes
    http.proxyHost : web-proxy
    java.vendor : BEA Systems, Inc.
    file.separator : /
    java.vendor.url.bug : http://support.bea.com
    sun.cpu.endian : little
    sun.io.unicode.encoding : UnicodeLittle
    https.proxyPort : 8088
    sun.desktop : gnome
    sun.cpu.isalist :

    So, its the same java.home behaviour as yours: we get the JRE under the
    JDK. And yet javac works

    Looking at javac
    ls -l `which javac`
    lrwxrwxrwx 1 root root 23 2007-11-06 10:14 /usr/bin/javac ->
    /etc/alternatives/javac
    ls -l /etc/alternatives/javac
    lrwxrwxrwx 1 root root 23 2008-12-09 17:20 /etc/alternatives/javac ->
    /usr/java/jdk/bin/javac

    So, it points to the one under JAVA_HOME.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Cole, Derek E at May 14, 2009 at 3:23 pm
    Ashley, can you post a snippet of how you set up the project you launch
    programmatically from java?

    What does your build file that you are running from java contain in it?

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.
    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,
    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org

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

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Ashley Williams at May 14, 2009 at 3:36 pm
    I did a lot of copying and pasting from this website to get my own
    code up and running:

    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html

    However I still believe the problem is with your environment rather
    than your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your build.xml
    file. And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment correctly?
    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you
    launch
    programmatically from java?

    What does your build file that you are running from java contain in
    it?

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.
    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <ashpublic@mac.com>
    wrote:
    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,
    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/
    jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the
    error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org

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

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


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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 15, 2009 at 9:51 pm
    Hey all,

    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams wrote:

    I did a lot of copying and pasting from this website to get my own code up
    and running:


    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html

    However I still believe the problem is with your environment rather than
    your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your build.xml file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you launch
    programmatically from java?

    What does your build file that you are running from java contain in it?

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre
    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,
    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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



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

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

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Francis Galiegue at May 15, 2009 at 9:55 pm

    Le Friday 15 May 2009 23:50:50 David Nemer, vous avez écrit :
    Hey all,

    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??
    What about JDK_HOME?

    --
    Francis Galiegue
    fge@one2team.com
    Ingénieur système
    Mob : +33 (0) 683 877 875
    Tel : +33 (0) 178 945 552
    One2team
    40 avenue Raymond Poincaré
    75116 Paris

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 15, 2009 at 9:59 pm
    It wouldn't work since ANT looks for JAVA_HOME.
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Fri, May 15, 2009 at 11:55 PM, Francis Galiegue wrote:

    Le Friday 15 May 2009 23:50:50 David Nemer, vous avez écrit :
    Hey all,

    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??
    What about JDK_HOME?

    --
    Francis Galiegue
    fge@one2team.com
    Ingénieur système
    Mob : +33 (0) 683 877 875
    Tel : +33 (0) 178 945 552
    One2team
    40 avenue Raymond Poincaré
    75116 Paris

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 15, 2009 at 10:44 pm
    I just found this:

    "/jdk1.6.0/jre:

    Root directory of the Java runtime environment used by the JDK development
    tools. The runtime environment is an implementation of the Java platform.
    This is the directory referred to by the java.home system property."

    http://209.85.129.132/search?q=cache:8l-7heUAnRMJ:www.iitk.ac.in/esc101/share/documentation/docs/technotes/tools/linux/jdkfiles.html+%22java.home%22+/jre+JDK&cd=33&hl=en&ct=clnk&client=firefox-a

    So, some how JAVA has already, as its default, the variable java.home as
    JAVA_HOME/jre

    No the question is, how to overcome this problem?? How to make Java look
    into the JAVA_HOME instead of JAVA_HOME/jre???

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Fri, May 15, 2009 at 11:58 PM, David Nemer wrote:

    It wouldn't work since ANT looks for JAVA_HOME.
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Fri, May 15, 2009 at 11:55 PM, Francis Galiegue wrote:

    Le Friday 15 May 2009 23:50:50 David Nemer, vous avez écrit :
    Hey all,

    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??
    What about JDK_HOME?

    --
    Francis Galiegue
    fge@one2team.com
    Ingénieur système
    Mob : +33 (0) 683 877 875
    Tel : +33 (0) 178 945 552
    One2team
    40 avenue Raymond Poincaré
    75116 Paris

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Supareno at May 16, 2009 at 10:51 am
    David ,

    are you using an IDE to run this simple code or are you using the
    command line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno
    Hey all,

    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams wrote:

    I did a lot of copying and pasting from this website to get my own code up
    and running:


    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html

    However I still believe the problem is with your environment rather than
    your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your build.xml file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you launch
    programmatically from java?

    What does your build file that you are running from java contain in it?

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as
    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre
    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I

    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,

    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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



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


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


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


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

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



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 16, 2009 at 1:36 pm
    Hello Supareno,

    I running it using the command line (running in a linux-server ). And ant is
    also running properly.

    Cheers,
    --
    David Nemer

    On Sat, May 16, 2009 at 12:51 PM, supareno wrote:

    David ,

    are you using an IDE to run this simple code or are you using the command
    line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno


    Hey all,
    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I
    look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com>
    wrote:


    I did a lot of copying and pasting from this website to get my own code
    up
    and running:



    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html

    However I still believe the problem is with your environment rather than
    your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your build.xml
    file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you launch

    programmatically from java?

    What does your build file that you are running from java contain in it?

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as

    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I


    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,


    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany


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



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


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



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


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


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




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Martin Gainty at May 16, 2009 at 1:50 pm
    Herr Nemer

    you would'nt be able to run ANT if your JAVA environment vars was fouled up
    JRE_HOME points to JRE folder (which contains only java.exe)
    JDK_HOME points to location of BASE FOLDER of javac.exe
    PATH=%JDK_HOME%/bin

    Mit Freundliche Gruben
    Martin
    GMT+5
    das Amerika
    ______________________________________________
    Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
    Ez az
    üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
    jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
    készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
    semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
    könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
    ezen üzenet tartalma miatt.

    Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
    Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



    Date: Sat, 16 May 2009 15:36:19 +0200
    Subject: Re: Java in JDK but ANT can't find it!
    From: davidnemer@gmail.com
    To: user@ant.apache.org

    Hello Supareno,

    I running it using the command line (running in a linux-server ). And ant is
    also running properly.

    Cheers,
    --
    David Nemer

    On Sat, May 16, 2009 at 12:51 PM, supareno wrote:

    David ,

    are you using an IDE to run this simple code or are you using the command
    line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno


    Hey all,
    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I
    look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com>
    wrote:


    I did a lot of copying and pasting from this website to get my own code
    up
    and running:



    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html

    However I still believe the problem is with your environment rather than
    your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your build.xml
    file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you launch

    programmatically from java?

    What does your build file that you are running from java contain in it?

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as

    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I


    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,


    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany


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



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


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



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


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


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




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
    _________________________________________________________________
    Hotmail® goes with you.
    http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
  • David Nemer at May 16, 2009 at 2:12 pm
    Hello Martin,

    The vars are all set up right. And it is "not" an ANT problem. The problem
    is that the "java.home" points to JAVA_HOME/jre , if I ever call this method
    "System.getProperty("java.home");" it will return to me JAVA_HOME/jre
    (/opt/jdk1.6.0_06/jre in my case). And all we want is the pure JAVA_HOME (no
    /jre).

    So I found this interesting post that explains better:

    "println ( System.properties.'java.home' );

    prints the path to the JRE for me as well. This is of course not surprising
    and exactly as it should be since this is the path to the JVM, not to the
    JDK.

    I think it is clear that the Ant error message is completely misleading. I
    have added a bug report in the Ant Bugzilla (43794).

    I think we have to find out what Ant does internally to allow the javac task
    to run, so that we know how Ant gets round this problem."



    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 3:50 PM, Martin Gainty wrote:


    Herr Nemer

    you would'nt be able to run ANT if your JAVA environment vars was fouled up
    JRE_HOME points to JRE folder (which contains only java.exe)
    JDK_HOME points to location of BASE FOLDER of javac.exe
    PATH=%JDK_HOME%/bin

    Mit Freundliche Gruben
    Martin
    GMT+5
    das Amerika
    ______________________________________________
    Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
    Vertraulichkeitanmerkung/Note de déni et de confidentialité
    Ez az
    üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
    jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
    készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
    semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
    könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
    ezen üzenet tartalma miatt.

    Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
    Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
    Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
    dient lediglich dem Austausch von Informationen und entfaltet keine
    rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
    E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
    Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
    destinataire prévu, nous te demandons avec bonté que pour satisfaire
    informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
    de ceci est interdite. Ce message sert à l'information seulement et n'aura
    pas n'importe quel effet légalement obligatoire. Étant donné que les email
    peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
    aucune responsabilité pour le contenu fourni.



    Date: Sat, 16 May 2009 15:36:19 +0200
    Subject: Re: Java in JDK but ANT can't find it!
    From: davidnemer@gmail.com
    To: user@ant.apache.org

    Hello Supareno,

    I running it using the command line (running in a linux-server ). And ant is
    also running properly.

    Cheers,
    --
    David Nemer

    On Sat, May 16, 2009 at 12:51 PM, supareno wrote:

    David ,

    are you using an IDE to run this simple code or are you using the
    command
    line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno


    Hey all,
    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I
    look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com>
    wrote:


    I did a lot of copying and pasting from this website to get my own
    code
    up
    and running:


    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
    However I still believe the problem is with your environment rather
    than
    your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your build.xml
    file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you
    launch
    programmatically from java?

    What does your build file that you are running from java contain in
    it?
    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as

    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <
    ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly.
    I

    still ran into the problem. The OP here also said JAVA_HOME was
    set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,


    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws
    that
    exception).

    I already set all of my environment variables to
    /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the
    error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany


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


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


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



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

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


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




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
    _________________________________________________________________
    Hotmail® goes with you.

    http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
  • Ashley Williams at May 16, 2009 at 3:25 pm
    Try adding these lines to the start of main():

    System.out.println("java.home: " + System.getProperty("java.home"));
    System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME"));
    System.out.println("PATH: " + System.getenv("JAVA_HOME"));

    Ant will print out the error message if it can't find the class
    com.sun.tools.javac.Main
    via the classloader, so I would suggest you convince yourself that
    your program can find
    that class. Usually this will be true if you are running the program
    with jdk/bin/java and not jdk/jre/bin/java,
    regardless of JAVA_HOME and java.home.

    Try modifying the ant launch script and hardcode a path to jdk/bin/
    java - if you no longer get
    a warning message then you know you are on the right track.

    On 16 May 2009, at 15:11, David Nemer wrote:

    Hello Martin,

    The vars are all set up right. And it is "not" an ANT problem. The
    problem
    is that the "java.home" points to JAVA_HOME/jre , if I ever call
    this method
    "System.getProperty("java.home");" it will return to me JAVA_HOME/jre
    (/opt/jdk1.6.0_06/jre in my case). And all we want is the pure
    JAVA_HOME (no
    /jre).

    So I found this interesting post that explains better:

    "println ( System.properties.'java.home' );

    prints the path to the JRE for me as well. This is of course not
    surprising
    and exactly as it should be since this is the path to the JVM, not
    to the
    JDK.

    I think it is clear that the Ant error message is completely
    misleading. I
    have added a bug report in the Ant Bugzilla (43794).

    I think we have to find out what Ant does internally to allow the
    javac task
    to run, so that we know how Ant gets round this problem."



    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 3:50 PM, Martin Gainty wrote:


    Herr Nemer

    you would'nt be able to run ANT if your JAVA environment vars was
    fouled up
    JRE_HOME points to JRE folder (which contains only java.exe)
    JDK_HOME points to location of BASE FOLDER of javac.exe
    PATH=%JDK_HOME%/bin

    Mit Freundliche Gruben
    Martin
    GMT+5
    das Amerika
    ______________________________________________
    Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
    Vertraulichkeitanmerkung/Note de déni et de confidentialité
    Ez az
    üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
    jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
    készítése nem megengedett. Ez az üzenet csak ismeret cserét
    szolgál és
    semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus
    üzenetek
    könnyen megváltoztathatóak, ezért minket semmi felelöség nem
    terhelhet
    ezen üzenet tartalma miatt.

    Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
    Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
    unbefugte
    Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
    Nachricht
    dient lediglich dem Austausch von Informationen und entfaltet keine
    rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit
    von
    E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
    Ce message est confidentiel et peut être privilégié. Si vous n'êtes
    pas le
    destinataire prévu, nous te demandons avec bonté que pour satisfaire
    informez l'expéditeur. N'importe quelle diffusion non autorisée ou
    la copie
    de ceci est interdite. Ce message sert à l'information seulement et
    n'aura
    pas n'importe quel effet légalement obligatoire. Étant donné que
    les email
    peuvent facilement être sujets à la manipulation, nous ne pouvons
    accepter
    aucune responsabilité pour le contenu fourni.



    Date: Sat, 16 May 2009 15:36:19 +0200
    Subject: Re: Java in JDK but ANT can't find it!
    From: davidnemer@gmail.com
    To: user@ant.apache.org

    Hello Supareno,

    I running it using the command line (running in a linux-server ).
    And ant is
    also running properly.

    Cheers,
    --
    David Nemer


    On Sat, May 16, 2009 at 12:51 PM, supareno <reno.rkcrew@free.fr>
    wrote:
    David ,

    are you using an IDE to run this simple code or are you using the
    command
    line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno


    Hey all,
    Well, I did some testing, and I tried to run this simples Java
    code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all
    point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else
    could I
    look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get
    the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com
    wrote:


    I did a lot of copying and pasting from this website to get my
    own
    code
    up
    and running:


    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
    However I still believe the problem is with your environment
    rather
    than
    your code.
    Try editing the ant batch file or shell script in order to
    print out
    JAVA_HOME and PATH and
    just at the point where it runs
    org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your
    build.xml
    file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you
    launch
    programmatically from java?

    What does your build file that you are running from java
    contain in
    it?
    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your
    application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the
    same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as

    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path,
    but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <
    ashpublic@mac.com>
    wrote:

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/
    jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead




    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set
    correctly.
    I

    still ran into the problem. The OP here also said JAVA_HOME
    was
    set
    correctly. There is some missing step here that prevents
    the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,


    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to
    find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still
    throws
    that
    exception).

    I already set all of my environment variables to
    /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on
    the
    error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre
    (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is
    there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany


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


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


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



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

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


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




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
    _________________________________________________________________
    Hotmail® goes with you.

    http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
  • David Nemer at May 16, 2009 at 4:08 pm
    Hello Ashley,

    So I ran the code you suggested and

    System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME"));
    System.out.println("PATH: " + System.getenv("JAVA_HOME"));

    Prints the right path to the JDK. So, would you suggest me to go into the
    ANT CompilerAdapterFactory.java source file and modify the
    "System.getProperty("java.home")" to System.getenv("JAVA_HOME") ?

    I can't think of anything else in order to solve this.

    Derek, when you told me to do this: "AntClassLoader ACL = new
    AntClassLoader(antproject, path, true);" what else am I supposed to do??
    Just set the AntClassLoader to the ant project, path = null, and true? Am I
    supposed to use ACL for anything else?

    Cheers,
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 5:25 PM, Ashley Williams wrote:

    Try adding these lines to the start of main():

    System.out.println("java.home: " + System.getProperty("java.home"));
    System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME"));
    System.out.println("PATH: " + System.getenv("JAVA_HOME"));

    Ant will print out the error message if it can't find the class
    com.sun.tools.javac.Main
    via the classloader, so I would suggest you convince yourself that your
    program can find
    that class. Usually this will be true if you are running the program with
    jdk/bin/java and not jdk/jre/bin/java,
    regardless of JAVA_HOME and java.home.

    Try modifying the ant launch script and hardcode a path to jdk/bin/java -
    if you no longer get
    a warning message then you know you are on the right track.



    On 16 May 2009, at 15:11, David Nemer wrote:

    Hello Martin,
    The vars are all set up right. And it is "not" an ANT problem. The problem
    is that the "java.home" points to JAVA_HOME/jre , if I ever call this
    method
    "System.getProperty("java.home");" it will return to me JAVA_HOME/jre
    (/opt/jdk1.6.0_06/jre in my case). And all we want is the pure JAVA_HOME
    (no
    /jre).

    So I found this interesting post that explains better:

    "println ( System.properties.'java.home' );

    prints the path to the JRE for me as well. This is of course not
    surprising
    and exactly as it should be since this is the path to the JVM, not to the
    JDK.

    I think it is clear that the Ant error message is completely misleading. I
    have added a bug report in the Ant Bugzilla (43794).

    I think we have to find out what Ant does internally to allow the javac
    task
    to run, so that we know how Ant gets round this problem."



    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 3:50 PM, Martin Gainty <mgainty@hotmail.com>
    wrote:

    Herr Nemer

    you would'nt be able to run ANT if your JAVA environment vars was fouled
    up
    JRE_HOME points to JRE folder (which contains only java.exe)
    JDK_HOME points to location of BASE FOLDER of javac.exe
    PATH=%JDK_HOME%/bin

    Mit Freundliche Gruben
    Martin
    GMT+5
    das Amerika
    ______________________________________________
    Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
    Vertraulichkeitanmerkung/Note de déni et de confidentialité
    Ez az
    üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
    jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
    készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
    semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
    könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
    ezen üzenet tartalma miatt.

    Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
    Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
    unbefugte
    Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
    dient lediglich dem Austausch von Informationen und entfaltet keine
    rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
    E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
    Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
    le
    destinataire prévu, nous te demandons avec bonté que pour satisfaire
    informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
    copie
    de ceci est interdite. Ce message sert à l'information seulement et
    n'aura
    pas n'importe quel effet légalement obligatoire. Étant donné que les
    email
    peuvent facilement être sujets à la manipulation, nous ne pouvons
    accepter
    aucune responsabilité pour le contenu fourni.




    Date: Sat, 16 May 2009 15:36:19 +0200
    Subject: Re: Java in JDK but ANT can't find it!
    From: davidnemer@gmail.com
    To: user@ant.apache.org

    Hello Supareno,

    I running it using the command line (running in a linux-server ). And
    ant is
    also running properly.

    Cheers,
    --
    David Nemer


    On Sat, May 16, 2009 at 12:51 PM, supareno wrote:

    David ,
    are you using an IDE to run this simple code or are you using the
    command
    line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno


    Hey all,
    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I
    look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com>
    wrote:



    I did a lot of copying and pasting from this website to get my own
    code
    up
    and running:



    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
    However I still believe the problem is with your environment rather
    than
    your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your build.xml
    file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you launch
    programmatically from java?
    What does your build file that you are running from java contain in it?
    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as


    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <
    ashpublic@mac.com>
    wrote:
    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre


    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead



    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I

    still ran into the problem. The OP here also said JAVA_HOME was
    set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,



    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws
    that
    exception).
    I already set all of my environment variables to
    /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the
    error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

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




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

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



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




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



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




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




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

    _________________________________________________________________
    Hotmail® goes with you.


    http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
  • David Nemer at May 16, 2009 at 4:53 pm
    Hello Everyone,

    So here's what I did... I modified the source file JavaEnvUtils.java from
    ANT (ant.jar), I changed the line #47:

    private static final String JAVA_HOME = System.getProperty("java.home");
    to: private static final String JAVA_HOME = System.getenv("JAVA_HOME");

    I compiled everything and added the JavaEnvUtils.class into ant.jar..
    everything seemed to be working fine, but then I got the error msg:

    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06"

    Now, ANT goes to my JDK folder, it gets the right JAVA_HOME path, with no
    JRE, but it still says that it is not a JDK java!!

    I'm about to give up... I dunno what else to do...

    HELP please!!! Ant is driving me crazy!!!

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 6:07 PM, David Nemer wrote:

    Hello Ashley,

    So I ran the code you suggested and

    System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME"));
    System.out.println("PATH: " + System.getenv("JAVA_HOME"));

    Prints the right path to the JDK. So, would you suggest me to go into the
    ANT CompilerAdapterFactory.java source file and modify the
    "System.getProperty("java.home")" to System.getenv("JAVA_HOME") ?

    I can't think of anything else in order to solve this.

    Derek, when you told me to do this: "AntClassLoader ACL = new
    AntClassLoader(antproject, path, true);" what else am I supposed to do??
    Just set the AntClassLoader to the ant project, path = null, and true? Am I
    supposed to use ACL for anything else?

    Cheers,
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 5:25 PM, Ashley Williams wrote:

    Try adding these lines to the start of main():

    System.out.println("java.home: " + System.getProperty("java.home"));
    System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME"));
    System.out.println("PATH: " + System.getenv("JAVA_HOME"));

    Ant will print out the error message if it can't find the class
    com.sun.tools.javac.Main
    via the classloader, so I would suggest you convince yourself that your
    program can find
    that class. Usually this will be true if you are running the program with
    jdk/bin/java and not jdk/jre/bin/java,
    regardless of JAVA_HOME and java.home.

    Try modifying the ant launch script and hardcode a path to jdk/bin/java -
    if you no longer get
    a warning message then you know you are on the right track.



    On 16 May 2009, at 15:11, David Nemer wrote:

    Hello Martin,
    The vars are all set up right. And it is "not" an ANT problem. The
    problem
    is that the "java.home" points to JAVA_HOME/jre , if I ever call this
    method
    "System.getProperty("java.home");" it will return to me JAVA_HOME/jre
    (/opt/jdk1.6.0_06/jre in my case). And all we want is the pure JAVA_HOME
    (no
    /jre).

    So I found this interesting post that explains better:

    "println ( System.properties.'java.home' );

    prints the path to the JRE for me as well. This is of course not
    surprising
    and exactly as it should be since this is the path to the JVM, not to the
    JDK.

    I think it is clear that the Ant error message is completely misleading.
    I
    have added a bug report in the Ant Bugzilla (43794).

    I think we have to find out what Ant does internally to allow the javac
    task
    to run, so that we know how Ant gets round this problem."



    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 3:50 PM, Martin Gainty <mgainty@hotmail.com>
    wrote:

    Herr Nemer

    you would'nt be able to run ANT if your JAVA environment vars was fouled
    up
    JRE_HOME points to JRE folder (which contains only java.exe)
    JDK_HOME points to location of BASE FOLDER of javac.exe
    PATH=%JDK_HOME%/bin

    Mit Freundliche Gruben
    Martin
    GMT+5
    das Amerika
    ______________________________________________
    Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
    Vertraulichkeitanmerkung/Note de déni et de confidentialité
    Ez az
    üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
    jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
    készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
    semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
    könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
    ezen üzenet tartalma miatt.

    Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
    Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
    unbefugte
    Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
    Nachricht
    dient lediglich dem Austausch von Informationen und entfaltet keine
    rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
    E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
    Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
    le
    destinataire prévu, nous te demandons avec bonté que pour satisfaire
    informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
    copie
    de ceci est interdite. Ce message sert à l'information seulement et
    n'aura
    pas n'importe quel effet légalement obligatoire. Étant donné que les
    email
    peuvent facilement être sujets à la manipulation, nous ne pouvons
    accepter
    aucune responsabilité pour le contenu fourni.




    Date: Sat, 16 May 2009 15:36:19 +0200
    Subject: Re: Java in JDK but ANT can't find it!
    From: davidnemer@gmail.com
    To: user@ant.apache.org

    Hello Supareno,

    I running it using the command line (running in a linux-server ). And
    ant is
    also running properly.

    Cheers,
    --
    David Nemer


    On Sat, May 16, 2009 at 12:51 PM, supareno <reno.rkcrew@free.fr>
    wrote:

    David ,
    are you using an IDE to run this simple code or are you using the
    command
    line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno


    Hey all,
    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could
    I
    look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com>
    wrote:



    I did a lot of copying and pasting from this website to get my own
    code
    up
    and running:



    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
    However I still believe the problem is with your environment rather
    than
    your code.
    Try editing the ant batch file or shell script in order to print out
    JAVA_HOME and PATH and
    just at the point where it runs
    org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your
    build.xml
    file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you launch
    programmatically from java?
    What does your build file that you are running from java contain in it?
    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application
    from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as


    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <
    ashpublic@mac.com>
    wrote:
    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre


    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead



    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I

    still ran into the problem. The OP here also said JAVA_HOME was
    set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,



    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find
    a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws
    that
    exception).
    I already set all of my environment variables to
    /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the
    error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is
    a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

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




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

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



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




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



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




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




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

    _________________________________________________________________
    Hotmail® goes with you.


    http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
  • David Nemer at May 16, 2009 at 5:58 pm
    I found this on a Forum online:

    "Does the javac task in your buildfile have fork="yes"? If not, then it
    doesn't matter what the java.home property is set to; ant will attempt to
    call the javac Main method in the same java process, which from your error
    is a JRE, not a JDK.

    *EDIT* Try setting the executable property of your javac task to the full
    path to the javac binary.

    ----------------

    I was looking for something like the "executable" property and just didn't
    see it. It's annoying that I have to set it for each javac task, but it
    works. Thanks."


    Does it ring any bells to any one?? Is it possible to set fork=yes
    programmatically?



    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 6:52 PM, David Nemer wrote:

    Hello Everyone,

    So here's what I did... I modified the source file JavaEnvUtils.java from
    ANT (ant.jar), I changed the line #47:

    private static final String JAVA_HOME = System.getProperty("java.home");
    to: private static final String JAVA_HOME = System.getenv("JAVA_HOME");

    I compiled everything and added the JavaEnvUtils.class into ant.jar..
    everything seemed to be working fine, but then I got the error msg:

    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06"

    Now, ANT goes to my JDK folder, it gets the right JAVA_HOME path, with no
    JRE, but it still says that it is not a JDK java!!

    I'm about to give up... I dunno what else to do...

    HELP please!!! Ant is driving me crazy!!!

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 6:07 PM, David Nemer wrote:

    Hello Ashley,

    So I ran the code you suggested and

    System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME"));
    System.out.println("PATH: " + System.getenv("JAVA_HOME"));

    Prints the right path to the JDK. So, would you suggest me to go into the
    ANT CompilerAdapterFactory.java source file and modify the
    "System.getProperty("java.home")" to System.getenv("JAVA_HOME") ?

    I can't think of anything else in order to solve this.

    Derek, when you told me to do this: "AntClassLoader ACL = new
    AntClassLoader(antproject, path, true);" what else am I supposed to do??
    Just set the AntClassLoader to the ant project, path = null, and true? Am I
    supposed to use ACL for anything else?

    Cheers,
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 5:25 PM, Ashley Williams wrote:

    Try adding these lines to the start of main():

    System.out.println("java.home: " + System.getProperty("java.home"));
    System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME"));
    System.out.println("PATH: " + System.getenv("JAVA_HOME"));

    Ant will print out the error message if it can't find the class
    com.sun.tools.javac.Main
    via the classloader, so I would suggest you convince yourself that your
    program can find
    that class. Usually this will be true if you are running the program with
    jdk/bin/java and not jdk/jre/bin/java,
    regardless of JAVA_HOME and java.home.

    Try modifying the ant launch script and hardcode a path to jdk/bin/java -
    if you no longer get
    a warning message then you know you are on the right track.



    On 16 May 2009, at 15:11, David Nemer wrote:

    Hello Martin,
    The vars are all set up right. And it is "not" an ANT problem. The
    problem
    is that the "java.home" points to JAVA_HOME/jre , if I ever call this
    method
    "System.getProperty("java.home");" it will return to me JAVA_HOME/jre
    (/opt/jdk1.6.0_06/jre in my case). And all we want is the pure JAVA_HOME
    (no
    /jre).

    So I found this interesting post that explains better:

    "println ( System.properties.'java.home' );

    prints the path to the JRE for me as well. This is of course not
    surprising
    and exactly as it should be since this is the path to the JVM, not to
    the
    JDK.

    I think it is clear that the Ant error message is completely misleading.
    I
    have added a bug report in the Ant Bugzilla (43794).

    I think we have to find out what Ant does internally to allow the javac
    task
    to run, so that we know how Ant gets round this problem."



    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 3:50 PM, Martin Gainty <mgainty@hotmail.com>
    wrote:

    Herr Nemer

    you would'nt be able to run ANT if your JAVA environment vars was
    fouled up
    JRE_HOME points to JRE folder (which contains only java.exe)
    JDK_HOME points to location of BASE FOLDER of javac.exe
    PATH=%JDK_HOME%/bin

    Mit Freundliche Gruben
    Martin
    GMT+5
    das Amerika
    ______________________________________________
    Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
    Vertraulichkeitanmerkung/Note de déni et de confidentialité
    Ez az
    üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
    jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
    készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
    semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
    könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
    ezen üzenet tartalma miatt.

    Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
    Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
    unbefugte
    Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
    Nachricht
    dient lediglich dem Austausch von Informationen und entfaltet keine
    rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
    E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
    Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
    le
    destinataire prévu, nous te demandons avec bonté que pour satisfaire
    informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
    copie
    de ceci est interdite. Ce message sert à l'information seulement et
    n'aura
    pas n'importe quel effet légalement obligatoire. Étant donné que les
    email
    peuvent facilement être sujets à la manipulation, nous ne pouvons
    accepter
    aucune responsabilité pour le contenu fourni.




    Date: Sat, 16 May 2009 15:36:19 +0200
    Subject: Re: Java in JDK but ANT can't find it!
    From: davidnemer@gmail.com
    To: user@ant.apache.org

    Hello Supareno,

    I running it using the command line (running in a linux-server ). And
    ant is
    also running properly.

    Cheers,
    --
    David Nemer


    On Sat, May 16, 2009 at 12:51 PM, supareno <reno.rkcrew@free.fr>
    wrote:

    David ,
    are you using an IDE to run this simple code or are you using the
    command
    line?
    is the 'ant' command line tool is working properly in a terminal?

    supareno


    Hey all,
    Well, I did some testing, and I tried to run this simples Java code:

    public static void main(String args[]){

    String JAVA_HOME = System.getProperty("java.home");
    System.out.println(JAVA_HOME);

    }

    And it prints out: /opt/jdk1.6.0_06/jre

    So, as Ashley said before, it is not an Ant's problem, it is an
    environment
    or Java problem.

    But, I checked, both, bash_profile and bashrc, and they all point to
    /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could
    I
    look
    at so I can find where this JRE is set.

    Does anyone know where the method System.getProperty goes to get the
    java.home? Like a file or something like that??

    Cheers

    PS: I also used that code to call and in my java code.

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com
    wrote:



    I did a lot of copying and pasting from this website to get my own
    code
    up
    and running:



    http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
    However I still believe the problem is with your environment rather
    than
    your code.
    Try editing the ant batch file or shell script in order to print
    out
    JAVA_HOME and PATH and
    just at the point where it runs
    org.apache.tools.ant.launch.Launcher.

    Then print out all environment variables at the top of your
    build.xml
    file.
    And print out
    java.home at the start of your java application.

    If you are forking the compiler, could it not be inheriting the
    environment
    correctly?


    On 14 May 2009, at 16:22, Cole, Derek E wrote:

    Ashley, can you post a snippet of how you set up the project you launch
    programmatically from java?
    What does your build file that you are running from java contain
    in it?
    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:54 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Check your PATH to make sure you are launching your application
    from
    the jdk and not the jre.

    I launch programatically and I don't get these errors with the
    same
    version of ant so it does
    sound as if the problem lies outside of ant.

    On 14 May 2009, at 15:46, David Nemer wrote:

    This is what I'm trying to tell you! My JAVA_HOME it is set as


    /opt/jdk1.6.0_06 I've triple checked it on my bash file! I also
    check with
    echo $JAVA_HOME and which java, they all tell the right path, but
    not ANT!
    This is why I don't understand where does ant get this /jre !!
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <
    ashpublic@mac.com>
    wrote:
    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre


    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead



    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set
    correctly. I

    still ran into the problem. The OP here also said JAVA_HOME was
    set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk
    directory
    instead,


    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,



    I am running ANT programmatically in JAVA. So, my task is to
    build the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error
    occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find
    a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws
    that
    exception).
    I already set all of my environment variables to
    /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the
    error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is
    a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

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




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

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



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




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



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




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




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

    _________________________________________________________________
    Hotmail® goes with you.


    http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
  • Michael Ludwig at May 16, 2009 at 6:31 pm

    David Nemer schrieb am 16.05.2009 um 18:52:34 (+0200):

    So here's what I did... I modified the source file JavaEnvUtils.java
    from ANT (ant.jar), I changed the line #47:

    private static final String JAVA_HOME = System.getProperty("java.home");
    to: private static final String JAVA_HOME = System.getenv("JAVA_HOME");
    I'd revert that change.

    Maybe even do a clean install, in case anyone else migth have modified
    the ant shell script.
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06"
    Try the equivalent of these on your system:

    C:\dev\Java :: which java
    C:/WINDOWS/java

    C:\dev\Java :: java -jar \jlib\ant-1.7.1\lib\ant-launcher.jar -version
    Unable to locate tools.jar. Expected to find it in
    C:\Programme\Java\jre6\lib\tools.jar
    Apache Ant version 1.7.1 compiled on June 27 2008

    Because that's a JRE. But if I use the JDK, no warning.

    C:\dev\Java :: C:\Programme\Java\jdk1.6.0_11\bin\java.exe -jar
    \jlib\ant-1.7.1\lib\ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    Should work the same for you using explicit paths.

    Michael Ludwig

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 16, 2009 at 6:52 pm
    Hello Michael,

    I undid that change into JavaEnvUtils.java.

    I executed the commands you said, and here is the outcome:

    nemer@kubrick:~$ java -jar /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/bin/java

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 8:30 PM, Michael Ludwig wrote:

    David Nemer schrieb am 16.05.2009 um 18:52:34 (+0200):
    So here's what I did... I modified the source file JavaEnvUtils.java
    from ANT (ant.jar), I changed the line #47:

    private static final String JAVA_HOME = System.getProperty("java.home");
    to: private static final String JAVA_HOME = System.getenv("JAVA_HOME");
    I'd revert that change.

    Maybe even do a clean install, in case anyone else migth have modified
    the ant shell script.
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06"
    Try the equivalent of these on your system:

    C:\dev\Java :: which java
    C:/WINDOWS/java

    C:\dev\Java :: java -jar \jlib\ant-1.7.1\lib\ant-launcher.jar -version
    Unable to locate tools.jar. Expected to find it in
    C:\Programme\Java\jre6\lib\tools.jar
    Apache Ant version 1.7.1 compiled on June 27 2008

    Because that's a JRE. But if I use the JDK, no warning.

    C:\dev\Java :: C:\Programme\Java\jdk1.6.0_11\bin\java.exe -jar
    \jlib\ant-1.7.1\lib\ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    Should work the same for you using explicit paths.

    Michael Ludwig

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Michael Ludwig at May 16, 2009 at 7:04 pm

    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):

    nemer@kubrick:~$ java -jar /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/bin/java
    So tools.jar is found alright. It's an environmental problem, either in
    the ant shell script (has that been tampered with?) or, more likely, the
    shell script you're using to launch it.

    Michael Ludwig

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 16, 2009 at 7:11 pm
    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it runs in the
    same JVM, and forking the ANT process might solve it. Do you have any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig wrote:

    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/bin/java
    So tools.jar is found alright. It's an environmental problem, either in
    the ant shell script (has that been tampered with?) or, more likely, the
    shell script you're using to launch it.

    Michael Ludwig

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 16, 2009 at 7:26 pm
    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/tools.jar
    to the classpath. It gives me a different error message: "Compile failed;
    see the compiler error output for details." there is no error msg and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 9:11 PM, David Nemer wrote:

    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it runs in the
    same JVM, and forking the ANT process might solve it. Do you have any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig wrote:

    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/bin/java
    So tools.jar is found alright. It's an environmental problem, either in
    the ant shell script (has that been tampered with?) or, more likely, the
    shell script you're using to launch it.

    Michael Ludwig

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Ashley Williams at May 17, 2009 at 1:00 pm
    Hi David,

    I never meant that you should modify the ant code.
    Try launching your app with the fully qualified
    path to the jdk java eg:
    /path/to/jdk/bin/java MyTestApp
    So in other words don't rely on your PATH environment variable. It
    could be
    also that the bootclasspath has been overridden so that tools.jar has
    been
    taken out. Are you on the mac, in which case you don't have tools.jar?

    Try the same experiment by stealing the very last line in the ant
    launcher
    script and hardcoding the values that you know you need to use. On my
    installation of ant I would start with this line:

    ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
    \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
    \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
    $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

    I say this again, the idea behind this is that you need to assume that
    your
    environment variables and shell scripts can't be trusted and therefore
    bipass them.

    I mentioned this before, but remove any compiler fork option so that
    the task
    is being executed in the same vm. Then if it behaves differently in a
    forked
    vm, you know that the vm environment isn't being inherited properly and
    that's where you need to look.

    You could try removing all java installations from your machine and then
    reinstalling just the jdk that you need. I know for example that windows
    gets up to tricks such as adding a java.exe in the windows system
    directory
    that is always first in the PATH that you have to remember to manually
    delete.

    Sorry you are having all these frustrating problems, good luck.

    On 16 May 2009, at 20:25, David Nemer wrote:

    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
    tools.jar
    to the classpath. It gives me a different error message: "Compile
    failed;
    see the compiler error output for details." there is no error msg
    and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 9:11 PM, David Nemer wrote:

    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it runs
    in the
    same JVM, and forking the ANT process might solve it. Do you have
    any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
    wrote:
    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/
    bin/java
    So tools.jar is found alright. It's an environmental problem,
    either in
    the ant shell script (has that been tampered with?) or, more
    likely, the
    shell script you're using to launch it.

    Michael Ludwig

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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Cole, Derek E at May 18, 2009 at 1:33 pm
    Here is how I have set this up to work:

    Project Antproject = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(Antproject, path, t);
    //this causes ant to use the system path classpath since I passed in a
    "true" value. To append //items, use something besides path = null.
    Antproject.setUserProperty("ant.file", someFile.getAbsolutePath());
    Antproject.fireBuildStarted();
    Antproject.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    Helper.parse(antproject, someFile);
    Antproject.executeTarget("package");
    Antproject.fireBuildFinished(null);

    This is not the complete source, but I did have to add some methods,
    etc. You will probably want to add some stuff to the classpath to
    include all the jar files in ant/lib directory. I also added the
    java_home/lib/tools.jar to the classpath on my system.

    I am going to start a blog with some of this info, because I also had a
    heck of a time capturing the javac tasks output when adding a logger to
    the build, as well as some other issues.


    I was running this java program using a <java> task in a separate ant
    file, btw. I also intend to fire a version from a perl script.


    -----Original Message-----
    From: Ashley Williams
    Sent: Sunday, May 17, 2009 9:00 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Hi David,

    I never meant that you should modify the ant code.
    Try launching your app with the fully qualified
    path to the jdk java eg:
    /path/to/jdk/bin/java MyTestApp
    So in other words don't rely on your PATH environment variable. It
    could be
    also that the bootclasspath has been overridden so that tools.jar has
    been
    taken out. Are you on the mac, in which case you don't have tools.jar?

    Try the same experiment by stealing the very last line in the ant
    launcher
    script and hardcoding the values that you know you need to use. On my
    installation of ant I would start with this line:

    ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
    \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
    \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
    $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

    I say this again, the idea behind this is that you need to assume that
    your
    environment variables and shell scripts can't be trusted and therefore
    bipass them.

    I mentioned this before, but remove any compiler fork option so that
    the task
    is being executed in the same vm. Then if it behaves differently in a
    forked
    vm, you know that the vm environment isn't being inherited properly and
    that's where you need to look.

    You could try removing all java installations from your machine and then
    reinstalling just the jdk that you need. I know for example that windows
    gets up to tricks such as adding a java.exe in the windows system
    directory
    that is always first in the PATH that you have to remember to manually
    delete.

    Sorry you are having all these frustrating problems, good luck.

    On 16 May 2009, at 20:25, David Nemer wrote:

    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
    tools.jar
    to the classpath. It gives me a different error message: "Compile
    failed;
    see the compiler error output for details." there is no error msg
    and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Sat, May 16, 2009 at 9:11 PM, David Nemer wrote:

    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it runs
    in the
    same JVM, and forking the ANT process might solve it. Do you have
    any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
    wrote:
    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/
    bin/java
    So tools.jar is found alright. It's an environmental problem,
    either in
    the ant shell script (has that been tampered with?) or, more
    likely, the
    shell script you're using to launch it.

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

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 18, 2009 at 8:41 pm
    Hey Derek,

    I tried to do what you did, but I still get the error.. I added the ACL to
    my code and tools/jar to my PATH... but still doesn't work. Here is a piece
    of my code.. I just wonder.. what else do you do with the ACL???

    Project p = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(p, path, t);

    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);



    try {
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);

    p.executeTarget(p.getDefaultTarget());
    p.fireBuildFinished(null);

    db.insertBuildData(Integer.toString(revisionNumber), "YES",
    "");
    } catch (BuildException e) {

    if (e.toString().contains("Unable to find a javac
    compiler;")){

    db.insertBuildData(Integer.toString(revisionNumber),
    "YES", "Unable to find a javac compiler");

    } else{
    db.insertBuildData(Integer.toString(revisionNumber),
    "NO", e.toString());
    }
    }

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Mon, May 18, 2009 at 3:33 PM, Cole, Derek E wrote:

    Here is how I have set this up to work:

    Project Antproject = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(Antproject, path, t);
    //this causes ant to use the system path classpath since I passed in a
    "true" value. To append //items, use something besides path = null.
    Antproject.setUserProperty("ant.file", someFile.getAbsolutePath());
    Antproject.fireBuildStarted();
    Antproject.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    Helper.parse(antproject, someFile);
    Antproject.executeTarget("package");
    Antproject.fireBuildFinished(null);

    This is not the complete source, but I did have to add some methods,
    etc. You will probably want to add some stuff to the classpath to
    include all the jar files in ant/lib directory. I also added the
    java_home/lib/tools.jar to the classpath on my system.

    I am going to start a blog with some of this info, because I also had a
    heck of a time capturing the javac tasks output when adding a logger to
    the build, as well as some other issues.


    I was running this java program using a <java> task in a separate ant
    file, btw. I also intend to fire a version from a perl script.


    -----Original Message-----
    From: Ashley Williams
    Sent: Sunday, May 17, 2009 9:00 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Hi David,

    I never meant that you should modify the ant code.
    Try launching your app with the fully qualified
    path to the jdk java eg:
    /path/to/jdk/bin/java MyTestApp
    So in other words don't rely on your PATH environment variable. It
    could be
    also that the bootclasspath has been overridden so that tools.jar has
    been
    taken out. Are you on the mac, in which case you don't have tools.jar?

    Try the same experiment by stealing the very last line in the ant
    launcher
    script and hardcoding the values that you know you need to use. On my
    installation of ant I would start with this line:

    ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
    \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
    \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
    $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

    I say this again, the idea behind this is that you need to assume that
    your
    environment variables and shell scripts can't be trusted and therefore
    bipass them.

    I mentioned this before, but remove any compiler fork option so that
    the task
    is being executed in the same vm. Then if it behaves differently in a
    forked
    vm, you know that the vm environment isn't being inherited properly and
    that's where you need to look.

    You could try removing all java installations from your machine and then
    reinstalling just the jdk that you need. I know for example that windows
    gets up to tricks such as adding a java.exe in the windows system
    directory
    that is always first in the PATH that you have to remember to manually
    delete.

    Sorry you are having all these frustrating problems, good luck.

    On 16 May 2009, at 20:25, David Nemer wrote:

    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
    tools.jar
    to the classpath. It gives me a different error message: "Compile
    failed;
    see the compiler error output for details." there is no error msg
    and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:11 PM, David Nemer <davidnemer@gmail.com>
    wrote:
    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it runs
    in the
    same JVM, and forking the ANT process might solve it. Do you have
    any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
    wrote:
    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/
    bin/java
    So tools.jar is found alright. It's an environmental problem,
    either in
    the ant shell script (has that been tampered with?) or, more
    likely, the
    shell script you're using to launch it.

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

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 18, 2009 at 8:51 pm
    This is the result I get from building it from my Java code:

    build-all:

    init:

    setproxy:

    xfire.get-deps:
    [mkdir] Created dir: /scratch2/nemer/test/xfire/target/lib
    [mkdir] Created dir: /scratch2/nemer/test/xfire/xfire-core/target/lib

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/geronimo-spec/jars/geronimo-spec-activation-1.0.2-rc4.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/geronimo-spec-activation-1.0.2-rc4.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/woodstox/jars/wstx-asl-2.9.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/wstx-asl-2.9.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/stax/jars/stax-1.1.2-dev.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/stax-1.1.2-dev.jar

    -download-dep:
    [get] Getting: http://www.ibiblio.org/maven/stax/jars/stax-api-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/stax-api-1.0.jar

    -download-dep:
    [get] Getting: http://www.ibiblio.org/maven/jdom/jars/jdom-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/jdom-1.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/wsdl4j/jars/wsdl4j-1.5.2.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/wsdl4j-1.5.2.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.4.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-logging-1.0.4.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/servletapi/jars/servletapi-2.3.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/servletapi-2.3.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/httpunit/jars/httpunit-1.6.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/httpunit-1.6.1.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/jaxen/jars/jaxen-1.1-beta-8.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/jaxen-1.1-beta-8.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/easymock/jars/easymock-1.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/easymock-1.1.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/xmlunit/jars/xmlunit-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/xmlunit-1.0.jar

    get-deps:

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-3.0.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-httpclient-3.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-codec/jars/commons-codec-1.3.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/commons-codec-1.3.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/jetty/jars/org.mortbay.jetty-5.1.3.jar
    [get] To:
    /scratch2/nemer/test/xfire/xfire-core/target/lib/org.mortbay.jetty-5.1.3.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/org.apache.ws.commons/jars/XmlSchema-1.0.jar
    [get] To:
    /scratch2/nemer/test/xfire/xfire-core/target/lib/XmlSchema-1.0.jar

    -download-dep:
    [get] Getting: http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/junit-3.8.1.jar

    compile:
    [mkdir] Created dir:
    /scratch2/nemer/test/xfire/xfire-core/target/classes
    [javac] Compiling 225 source files to
    /scratch2/nemer/test/xfire/xfire-core/target/classes

    BUILD SUCCESSFUL
    Total time: 32 seconds

    But I still get that error msg that JAVA_HOME is not pointed to a JDK Java.
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Mon, May 18, 2009 at 10:40 PM, David Nemer wrote:

    Hey Derek,

    I tried to do what you did, but I still get the error.. I added the ACL to
    my code and tools/jar to my PATH... but still doesn't work. Here is a piece
    of my code.. I just wonder.. what else do you do with the ACL???

    Project p = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(p, path, t);

    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);



    try {
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);

    p.executeTarget(p.getDefaultTarget());
    p.fireBuildFinished(null);

    db.insertBuildData(Integer.toString(revisionNumber), "YES",
    "");
    } catch (BuildException e) {

    if (e.toString().contains("Unable to find a javac
    compiler;")){

    db.insertBuildData(Integer.toString(revisionNumber),
    "YES", "Unable to find a javac compiler");

    } else{
    db.insertBuildData(Integer.toString(revisionNumber),
    "NO", e.toString());
    }
    }

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Mon, May 18, 2009 at 3:33 PM, Cole, Derek E wrote:

    Here is how I have set this up to work:

    Project Antproject = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(Antproject, path, t);
    //this causes ant to use the system path classpath since I passed in a
    "true" value. To append //items, use something besides path = null.
    Antproject.setUserProperty("ant.file", someFile.getAbsolutePath());
    Antproject.fireBuildStarted();
    Antproject.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    Helper.parse(antproject, someFile);
    Antproject.executeTarget("package");
    Antproject.fireBuildFinished(null);

    This is not the complete source, but I did have to add some methods,
    etc. You will probably want to add some stuff to the classpath to
    include all the jar files in ant/lib directory. I also added the
    java_home/lib/tools.jar to the classpath on my system.

    I am going to start a blog with some of this info, because I also had a
    heck of a time capturing the javac tasks output when adding a logger to
    the build, as well as some other issues.


    I was running this java program using a <java> task in a separate ant
    file, btw. I also intend to fire a version from a perl script.


    -----Original Message-----
    From: Ashley Williams
    Sent: Sunday, May 17, 2009 9:00 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Hi David,

    I never meant that you should modify the ant code.
    Try launching your app with the fully qualified
    path to the jdk java eg:
    /path/to/jdk/bin/java MyTestApp
    So in other words don't rely on your PATH environment variable. It
    could be
    also that the bootclasspath has been overridden so that tools.jar has
    been
    taken out. Are you on the mac, in which case you don't have tools.jar?

    Try the same experiment by stealing the very last line in the ant
    launcher
    script and hardcoding the values that you know you need to use. On my
    installation of ant I would start with this line:

    ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
    \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
    \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
    $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

    I say this again, the idea behind this is that you need to assume that
    your
    environment variables and shell scripts can't be trusted and therefore
    bipass them.

    I mentioned this before, but remove any compiler fork option so that
    the task
    is being executed in the same vm. Then if it behaves differently in a
    forked
    vm, you know that the vm environment isn't being inherited properly and
    that's where you need to look.

    You could try removing all java installations from your machine and then
    reinstalling just the jdk that you need. I know for example that windows
    gets up to tricks such as adding a java.exe in the windows system
    directory
    that is always first in the PATH that you have to remember to manually
    delete.

    Sorry you are having all these frustrating problems, good luck.

    On 16 May 2009, at 20:25, David Nemer wrote:

    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
    tools.jar
    to the classpath. It gives me a different error message: "Compile
    failed;
    see the compiler error output for details." there is no error msg
    and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:11 PM, David Nemer <davidnemer@gmail.com>
    wrote:
    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it runs
    in the
    same JVM, and forking the ANT process might solve it. Do you have
    any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
    wrote:
    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/
    bin/java
    So tools.jar is found alright. It's an environmental problem,
    either in
    the ant shell script (has that been tampered with?) or, more
    likely, the
    shell script you're using to launch it.

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

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Cole, Derek E at May 18, 2009 at 8:58 pm
    Can you post what you have your actual system path and classpath set to?


    -----Original Message-----
    From: David Nemer
    Sent: Monday, May 18, 2009 4:51 PM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    This is the result I get from building it from my Java code:

    build-all:

    init:

    setproxy:

    xfire.get-deps:
    [mkdir] Created dir: /scratch2/nemer/test/xfire/target/lib
    [mkdir] Created dir:
    /scratch2/nemer/test/xfire/xfire-core/target/lib

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/geronimo-spec/jars/geronimo-spec-activation
    -1.0.2-rc4.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/geronimo-spec-activation-1.0.2-rc4
    .jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/woodstox/jars/wstx-asl-2.9.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/wstx-asl-2.9.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/stax/jars/stax-1.1.2-dev.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/stax-1.1.2-dev.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/stax/jars/stax-api-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/stax-api-1.0.jar

    -download-dep:
    [get] Getting: http://www.ibiblio.org/maven/jdom/jars/jdom-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/jdom-1.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/wsdl4j/jars/wsdl4j-1.5.2.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/wsdl4j-1.5.2.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.4.
    jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-logging-1.0.4.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/servletapi/jars/servletapi-2.3.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/servletapi-2.3.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/httpunit/jars/httpunit-1.6.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/httpunit-1.6.1.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/jaxen/jars/jaxen-1.1-beta-8.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/jaxen-1.1-beta-8.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/easymock/jars/easymock-1.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/easymock-1.1.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/xmlunit/jars/xmlunit-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/xmlunit-1.0.jar

    get-deps:

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-
    3.0.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-httpclient-3.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-codec/jars/commons-codec-1.3.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-codec-1.3.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/jetty/jars/org.mortbay.jetty-5.1.3.jar
    [get] To:
    /scratch2/nemer/test/xfire/xfire-core/target/lib/org.mortbay.jetty-5.1.3
    .jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/org.apache.ws.commons/jars/XmlSchema-1.0.ja
    r
    [get] To:
    /scratch2/nemer/test/xfire/xfire-core/target/lib/XmlSchema-1.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/junit-3.8.1.jar

    compile:
    [mkdir] Created dir:
    /scratch2/nemer/test/xfire/xfire-core/target/classes
    [javac] Compiling 225 source files to
    /scratch2/nemer/test/xfire/xfire-core/target/classes

    BUILD SUCCESSFUL
    Total time: 32 seconds

    But I still get that error msg that JAVA_HOME is not pointed to a JDK
    Java.
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Mon, May 18, 2009 at 10:40 PM, David Nemer wrote:

    Hey Derek,

    I tried to do what you did, but I still get the error.. I added the ACL to
    my code and tools/jar to my PATH... but still doesn't work. Here is a piece
    of my code.. I just wonder.. what else do you do with the ACL???

    Project p = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(p, path, t);

    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);



    try {
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper =
    ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);

    p.executeTarget(p.getDefaultTarget());
    p.fireBuildFinished(null);

    db.insertBuildData(Integer.toString(revisionNumber), "YES",
    "");
    } catch (BuildException e) {

    if (e.toString().contains("Unable to find a javac
    compiler;")){

    db.insertBuildData(Integer.toString(revisionNumber),
    "YES", "Unable to find a javac compiler");

    } else{
    db.insertBuildData(Integer.toString(revisionNumber),
    "NO", e.toString());
    }
    }

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Mon, May 18, 2009 at 3:33 PM, Cole, Derek E
    wrote:
    Here is how I have set this up to work:

    Project Antproject = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(Antproject, path, t);
    //this causes ant to use the system path classpath since I passed in
    a
    "true" value. To append //items, use something besides path = null.
    Antproject.setUserProperty("ant.file", someFile.getAbsolutePath());
    Antproject.fireBuildStarted();
    Antproject.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    Helper.parse(antproject, someFile);
    Antproject.executeTarget("package");
    Antproject.fireBuildFinished(null);

    This is not the complete source, but I did have to add some methods,
    etc. You will probably want to add some stuff to the classpath to
    include all the jar files in ant/lib directory. I also added the
    java_home/lib/tools.jar to the classpath on my system.

    I am going to start a blog with some of this info, because I also had
    a
    heck of a time capturing the javac tasks output when adding a logger
    to
    the build, as well as some other issues.


    I was running this java program using a <java> task in a separate ant
    file, btw. I also intend to fire a version from a perl script.


    -----Original Message-----
    From: Ashley Williams
    Sent: Sunday, May 17, 2009 9:00 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Hi David,

    I never meant that you should modify the ant code.
    Try launching your app with the fully qualified
    path to the jdk java eg:
    /path/to/jdk/bin/java MyTestApp
    So in other words don't rely on your PATH environment variable. It
    could be
    also that the bootclasspath has been overridden so that tools.jar has
    been
    taken out. Are you on the mac, in which case you don't have
    tools.jar?
    Try the same experiment by stealing the very last line in the ant
    launcher
    script and hardcoding the values that you know you need to use. On my
    installation of ant I would start with this line:

    ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
    \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
    \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
    $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

    I say this again, the idea behind this is that you need to assume
    that
    your
    environment variables and shell scripts can't be trusted and
    therefore
    bipass them.

    I mentioned this before, but remove any compiler fork option so that
    the task
    is being executed in the same vm. Then if it behaves differently in a
    forked
    vm, you know that the vm environment isn't being inherited properly
    and
    that's where you need to look.

    You could try removing all java installations from your machine and
    then
    reinstalling just the jdk that you need. I know for example that
    windows
    gets up to tricks such as adding a java.exe in the windows system
    directory
    that is always first in the PATH that you have to remember to
    manually
    delete.

    Sorry you are having all these frustrating problems, good luck.

    On 16 May 2009, at 20:25, David Nemer wrote:

    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
    tools.jar
    to the classpath. It gives me a different error message: "Compile
    failed;
    see the compiler error output for details." there is no error msg
    and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:11 PM, David Nemer <davidnemer@gmail.com>
    wrote:
    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper =
    ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it
    runs
    in the
    same JVM, and forking the ANT process might solve it. Do you have
    any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
    wrote:
    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/
    bin/java
    So tools.jar is found alright. It's an environmental problem,
    either in
    the ant shell script (has that been tampered with?) or, more
    likely, the
    shell script you're using to launch it.

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

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • David Nemer at May 18, 2009 at 9:15 pm
    Here is my batch file

    1 # /etc/skel/.bash_profile
    2
    3 # This file is sourced by bash for login shells. The following line
    4 # runs your .bashrc and is recommended by the bash info pages.
    5 [[ -f ~/.bashrc ]] && . ~/.bashrc
    6
    7
    8 if [ `uname` = "Darwin" ]; then
    9
    10 export M2_HOME=/usr/share/maven
    11 export
    JAVA_HOME='/System/Library/Frameworks/JavaVM.framework/Versions/1.6/H
    ome/'
    12 else
    13
    14 export JAVA_HOME=/opt/jdk1.6.0_06
    15 export M2_HOME=/opt/maven-2.0.7
    16 CLASSPATH=/opt/jdk1.6.0_06/lib/tools.jar
    17 export CLASSPATH
    18
    19
    20 fi
    21
    22 export ANT_HOME=/home/nemer/apache-ant-1.7.1
    23 export
    PATH=${JAVA_HOME}/bin:${JAVA_HOME}/lib:${CLASSPATH}:${PATH}:${ANT_HOME}/bin:$
    {ANT_HOME}/lib:${ANT_HOME}/lib/ant.jar:${ANT_HOME}/lib/ant-launcher.jar:${ANT_HOME}/
    lib/ant-nodeps.jar:${ANT_HOME}/lib/ant-antlr.jar
    24
    25

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Mon, May 18, 2009 at 10:57 PM, Cole, Derek E wrote:

    Can you post what you have your actual system path and classpath set to?


    -----Original Message-----
    From: David Nemer
    Sent: Monday, May 18, 2009 4:51 PM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    This is the result I get from building it from my Java code:

    build-all:

    init:

    setproxy:

    xfire.get-deps:
    [mkdir] Created dir: /scratch2/nemer/test/xfire/target/lib
    [mkdir] Created dir:
    /scratch2/nemer/test/xfire/xfire-core/target/lib

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/geronimo-spec/jars/geronimo-spec-activation
    -1.0.2-rc4.jar<http://www.ibiblio.org/maven/geronimo-spec/jars/geronimo-spec-activation%0A-1.0.2-rc4.jar>
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/geronimo-spec-activation-1.0.2-rc4
    .jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/woodstox/jars/wstx-asl-2.9.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/wstx-asl-2.9.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/stax/jars/stax-1.1.2-dev.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/stax-1.1.2-dev.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/stax/jars/stax-api-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/stax-api-1.0.jar

    -download-dep:
    [get] Getting: http://www.ibiblio.org/maven/jdom/jars/jdom-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/jdom-1.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/wsdl4j/jars/wsdl4j-1.5.2.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/wsdl4j-1.5.2.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.4.
    jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-logging-1.0.4.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/servletapi/jars/servletapi-2.3.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/servletapi-2.3.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/httpunit/jars/httpunit-1.6.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/httpunit-1.6.1.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/jaxen/jars/jaxen-1.1-beta-8.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/jaxen-1.1-beta-8.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/easymock/jars/easymock-1.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/easymock-1.1.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/xmlunit/jars/xmlunit-1.0.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/xmlunit-1.0.jar

    get-deps:

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-
    3.0.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-httpclient-3.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/commons-codec/jars/commons-codec-1.3.jar
    [get] To:
    /scratch2/nemer/test/xfire/target/lib/commons-codec-1.3.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/jetty/jars/org.mortbay.jetty-5.1.3.jar
    [get] To:
    /scratch2/nemer/test/xfire/xfire-core/target/lib/org.mortbay.jetty-5.1.3
    .jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/org.apache.ws.commons/jars/XmlSchema-1.0.ja
    r
    [get] To:
    /scratch2/nemer/test/xfire/xfire-core/target/lib/XmlSchema-1.0.jar

    -download-dep:
    [get] Getting:
    http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar
    [get] To: /scratch2/nemer/test/xfire/target/lib/junit-3.8.1.jar

    compile:
    [mkdir] Created dir:
    /scratch2/nemer/test/xfire/xfire-core/target/classes
    [javac] Compiling 225 source files to
    /scratch2/nemer/test/xfire/xfire-core/target/classes

    BUILD SUCCESSFUL
    Total time: 32 seconds

    But I still get that error msg that JAVA_HOME is not pointed to a JDK
    Java.
    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany
    On Mon, May 18, 2009 at 10:40 PM, David Nemer wrote:

    Hey Derek,

    I tried to do what you did, but I still get the error.. I added the ACL to
    my code and tools/jar to my PATH... but still doesn't work. Here is a piece
    of my code.. I just wonder.. what else do you do with the ACL???

    Project p = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(p, path, t);

    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);



    try {
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper =
    ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);

    p.executeTarget(p.getDefaultTarget());
    p.fireBuildFinished(null);

    db.insertBuildData(Integer.toString(revisionNumber), "YES",
    "");
    } catch (BuildException e) {

    if (e.toString().contains("Unable to find a javac
    compiler;")){

    db.insertBuildData(Integer.toString(revisionNumber),
    "YES", "Unable to find a javac compiler");

    } else{
    db.insertBuildData(Integer.toString(revisionNumber),
    "NO", e.toString());
    }
    }

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Mon, May 18, 2009 at 3:33 PM, Cole, Derek E
    wrote:
    Here is how I have set this up to work:

    Project Antproject = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(Antproject, path, t);
    //this causes ant to use the system path classpath since I passed in
    a
    "true" value. To append //items, use something besides path = null.
    Antproject.setUserProperty("ant.file", someFile.getAbsolutePath());
    Antproject.fireBuildStarted();
    Antproject.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    Helper.parse(antproject, someFile);
    Antproject.executeTarget("package");
    Antproject.fireBuildFinished(null);

    This is not the complete source, but I did have to add some methods,
    etc. You will probably want to add some stuff to the classpath to
    include all the jar files in ant/lib directory. I also added the
    java_home/lib/tools.jar to the classpath on my system.

    I am going to start a blog with some of this info, because I also had
    a
    heck of a time capturing the javac tasks output when adding a logger
    to
    the build, as well as some other issues.


    I was running this java program using a <java> task in a separate ant
    file, btw. I also intend to fire a version from a perl script.


    -----Original Message-----
    From: Ashley Williams
    Sent: Sunday, May 17, 2009 9:00 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Hi David,

    I never meant that you should modify the ant code.
    Try launching your app with the fully qualified
    path to the jdk java eg:
    /path/to/jdk/bin/java MyTestApp
    So in other words don't rely on your PATH environment variable. It
    could be
    also that the bootclasspath has been overridden so that tools.jar has
    been
    taken out. Are you on the mac, in which case you don't have
    tools.jar?
    Try the same experiment by stealing the very last line in the ant
    launcher
    script and hardcoding the values that you know you need to use. On my
    installation of ant I would start with this line:

    ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
    \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
    \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
    $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

    I say this again, the idea behind this is that you need to assume
    that
    your
    environment variables and shell scripts can't be trusted and
    therefore
    bipass them.

    I mentioned this before, but remove any compiler fork option so that
    the task
    is being executed in the same vm. Then if it behaves differently in a
    forked
    vm, you know that the vm environment isn't being inherited properly
    and
    that's where you need to look.

    You could try removing all java installations from your machine and
    then
    reinstalling just the jdk that you need. I know for example that
    windows
    gets up to tricks such as adding a java.exe in the windows system
    directory
    that is always first in the PATH that you have to remember to
    manually
    delete.

    Sorry you are having all these frustrating problems, good luck.

    On 16 May 2009, at 20:25, David Nemer wrote:

    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
    tools.jar
    to the classpath. It gives me a different error message: "Compile
    failed;
    see the compiler error output for details." there is no error msg
    and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:11 PM, David Nemer <davidnemer@gmail.com>
    wrote:
    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper =
    ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it
    runs
    in the
    same JVM, and forking the ANT process might solve it. Do you have
    any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
    wrote:
    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/
    bin/java
    So tools.jar is found alright. It's an environmental problem,
    either in
    the ant shell script (has that been tampered with?) or, more
    likely, the
    shell script you're using to launch it.

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

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


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Supareno at May 18, 2009 at 8:55 pm
    David ,

    which version of Linux are you using?
    is it a Suse version?
    did you try do a clean install of java (the basic jdk, not the server
    version)?
    i'm asking such things because i saw some strange problems with a suse
    (i think it was a suse ans a Java server version)...

    i think that it cannot come from the tool (ant)
    it may come from the os and the java version....

    if you can, try to install a RedHat or an Ubuntu, compile a jdk 6 and
    tell us if it is working...

    supareno
    Hey Derek,

    I tried to do what you did, but I still get the error.. I added the ACL to
    my code and tools/jar to my PATH... but still doesn't work. Here is a piece
    of my code.. I just wonder.. what else do you do with the ACL???

    Project p = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(p, path, t);

    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);



    try {
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);

    p.executeTarget(p.getDefaultTarget());
    p.fireBuildFinished(null);

    db.insertBuildData(Integer.toString(revisionNumber), "YES",
    "");
    } catch (BuildException e) {

    if (e.toString().contains("Unable to find a javac
    compiler;")){

    db.insertBuildData(Integer.toString(revisionNumber),
    "YES", "Unable to find a javac compiler");

    } else{
    db.insertBuildData(Integer.toString(revisionNumber),
    "NO", e.toString());
    }
    }

    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Mon, May 18, 2009 at 3:33 PM, Cole, Derek E wrote:

    Here is how I have set this up to work:

    Project Antproject = new Project();

    boolean t = true;
    Path path = null;
    AntClassLoader ACL = new AntClassLoader(Antproject, path, t);
    //this causes ant to use the system path classpath since I passed in a
    "true" value. To append //items, use something besides path = null.
    Antproject.setUserProperty("ant.file", someFile.getAbsolutePath());
    Antproject.fireBuildStarted();
    Antproject.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    Helper.parse(antproject, someFile);
    Antproject.executeTarget("package");
    Antproject.fireBuildFinished(null);

    This is not the complete source, but I did have to add some methods,
    etc. You will probably want to add some stuff to the classpath to
    include all the jar files in ant/lib directory. I also added the
    java_home/lib/tools.jar to the classpath on my system.

    I am going to start a blog with some of this info, because I also had a
    heck of a time capturing the javac tasks output when adding a logger to
    the build, as well as some other issues.


    I was running this java program using a <java> task in a separate ant
    file, btw. I also intend to fire a version from a perl script.


    -----Original Message-----
    From: Ashley Williams
    Sent: Sunday, May 17, 2009 9:00 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    Hi David,

    I never meant that you should modify the ant code.
    Try launching your app with the fully qualified
    path to the jdk java eg:
    /path/to/jdk/bin/java MyTestApp
    So in other words don't rely on your PATH environment variable. It
    could be
    also that the bootclasspath has been overridden so that tools.jar has
    been
    taken out. Are you on the mac, in which case you don't have tools.jar?

    Try the same experiment by stealing the very last line in the ant
    launcher
    script and hardcoding the values that you know you need to use. On my
    installation of ant I would start with this line:

    ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
    \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
    \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
    $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

    I say this again, the idea behind this is that you need to assume that
    your
    environment variables and shell scripts can't be trusted and therefore
    bipass them.

    I mentioned this before, but remove any compiler fork option so that
    the task
    is being executed in the same vm. Then if it behaves differently in a
    forked
    vm, you know that the vm environment isn't being inherited properly and
    that's where you need to look.

    You could try removing all java installations from your machine and then
    reinstalling just the jdk that you need. I know for example that windows
    gets up to tricks such as adding a java.exe in the windows system
    directory
    that is always first in the PATH that you have to remember to manually
    delete.

    Sorry you are having all these frustrating problems, good luck.


    On 16 May 2009, at 20:25, David Nemer wrote:

    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
    tools.jar
    to the classpath. It gives me a different error message: "Compile
    failed;
    see the compiler error output for details." there is no error msg
    and it
    still says BUILD SUCCESSFUL


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:11 PM, David Nemer <davidnemer@gmail.com>
    wrote:

    Hello Michael,

    here is my code on how I'm invoking Ant:

    Project p = new Project();
    p.setUserProperty("ant.file",
    buildFile.getAbsolutePath());
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    p.fireBuildStarted();
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget(p.getDefaultTarget());

    Michael, I read somewhere that when you invoke ANT in java, it runs
    in the
    same JVM, and forking the ANT process might solve it. Do you have
    any idea
    how would I code this?? Make Ant ran in another JVM?


    --
    David Nemer
    Sent from Kaiserslautern, RP, Germany

    On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
    wrote:

    David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):

    nemer@kubrick:~$ java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
    -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
    /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
    Apache Ant version 1.7.1 compiled on June 27 2008

    so just running JAVA worked as well as running /opt/jdk1.6.0_06/
    bin/java
    So tools.jar is found alright. It's an environmental problem,
    either in
    the ant shell script (has that been tampered with?) or, more
    likely, the
    shell script you're using to launch it.

    Michael Ludwig

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

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


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



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Steve Loughran at May 18, 2009 at 2:47 pm

    David Nemer wrote:
    Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/tools.jar
    to the classpath. It gives me a different error message: "Compile failed;
    see the compiler error output for details." there is no error msg and it
    still says BUILD SUCCESSFUL
    1. is this a package-manager installation of Ant?
    2. What does ant -diagnostics say?

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Cole, Derek E at May 14, 2009 at 2:47 pm

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK!

    The error message from ant appends "jre" to the end of whatever you have
    JAVA_HOME set to, so it returns something like this:
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"
    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 10:43 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    In your description you say that JAVA_HOME=/opt/jdk1.6.0_06/jre

    Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead


    On 14 May 2009, at 15:28, Cole, Derek E wrote:

    When I had this problem, I KNOW that JAVA_HOME was set correctly. I
    still ran into the problem. The OP here also said JAVA_HOME was set
    correctly. There is some missing step here that prevents the ant
    Project
    instance from knowing which Java to use.

    -----Original Message-----
    From: Ashley Williams
    Sent: Thursday, May 14, 2009 9:56 AM
    To: Ant Users List
    Subject: Re: Java in JDK but ANT can't find it!

    It looks like you are pointing to the jre not the jdk.
    Try repointing the JAVA_HOME environment variable to the jdk directory
    instead,

    On 14 May 2009, at 13:15, David Nemer wrote:

    Hello Everyone,

    I am running ANT programmatically in JAVA. So, my task is to build
    the
    BUILD.XML.
    I'm able to do so, but it throws an exception saying:

    /scratch2/nemer/test/xfire/build.xml:5: The following error occurred
    while
    executing this line:
    /scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a
    javac
    compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK.
    It is currently set to "/opt/jdk1.6.0_06/jre"

    But in the end it says: BUILD SUCCESSFUL (but it still throws that
    exception).

    I already set all of my environment variables to /opt/jdk1.6.0_06/
    (JAVA_HOME and also in PATH), which is a JDK! And even on the error
    message
    it says that the java is set to /opt/jdk1.6.0_06/jre (which is a
    JDK, I
    don't know where it gets the jre from).

    So, does any one know how can I solve this problem? Is there a
    configuration
    file in ANT that we need to set up! I'm stuck there!!

    I'm running the ant 1.7.1.

    Cheers,
    --
    David Nemer
    Sent from Saarbrucken, SL, Germany

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


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

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


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesant
postedMay 14, '09 at 12:15p
activeMay 19, '09 at 11:07a
posts41
users9
websiteant.apache.org

People

Translate

site design / logo © 2017 Grokbase