ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashley Williams <ashpub...@mac.com>
Subject Re: Java in JDK but ANT can't find it!
Date Thu, 14 May 2009 15:09:38 GMT
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 <ashpublic@mac.com>  
> 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 [mailto:ashpublic@mac.com]
>>>>> 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
>>
>>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message