You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Peterson, Elena S" <el...@pnl.gov> on 2006/01/05 03:54:00 UTC

Java.home changing

Hello all,

I've searched and searched through the archive and cannot find an answer
to this particular question.  I have a simple build file with a javac
command.  I get this message when it runs:

BUILD FAILED
C:\eclipse\workspace\PQuad\build.xml:131: 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

So I checked to see what the value of java.home is and that's the part
that's confusing me.  Before any of the targets run it points to my jdk
(which is what the JAVA_HOME environment variable points to).  However
as soon as any target is called it points to a jre.

As you can tell from the error message I'm running this in eclipse 3.1.1
on a windows box.  I have none of the "other" ant environment variables
set.  Java is in my path (in the windows directory) but javac is not.

Any help/guidance you could provide me would be greatly appreciated.

Thanks,

Elena  

Elena S. Peterson
Senior Research Scientist II
Pacific Northwest National Laboratory
Elena@pnl.gov



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


Re: Java.home changing

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 04 Jan 2006, Elena S. Peterson <el...@pnl.gov> wrote:

> So I checked to see what the value of java.home is and that's the
> part that's confusing me.  Before any of the targets run it points
> to my jdk (which is what the JAVA_HOME environment variable points
> to).  However as soon as any target is called it points to a jre.

The java.home system property and the JAVA_HOME environment variable
are two different things.  java.home always points to the JRE and Ant
knows that, JAVA_HOME is evaluated by the Ant wrapper script.

Since you are using Eclipse instead of the wrapper script, JAVA_HOME
may be ignored (I'm not familiar enough with the Ant Eclipse
integration to know) and the error message is a bit misleading.

The code that emits the error message tries to locate tools.jar
relative to the java.home system property using the well known layout
of the JDK.

> Java is in my path (in the windows directory) but javac is not.

The problem is your parentesis.  If java.home points to the Windows
directory you are outside of the JDK directory and any assumptions on
the file system layout are wrong.

Make sure that Eclipse is run by the java executable located in your
%JAVA_HOME%/jre/bin directory instead of the one in the Windows
directory.

Stefan

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


Re: Java.home changing

Posted by Arti Singh <ar...@yahoo.ca>.
Hi Elana,
                  Questions regarding JAVA_HOME should be posted to a java newbie users  list.Never the less I will help since I was using Eclipse ans had the  same problem a few years back.
  
  You need to set  your path to your J2SDK-j2sdk/bin directory in the auto exec.bat file.Try sysedit:run sysecit
  set path=C:/j2sdk1.5_2/bin
  and then set your JAVA_HOME  in your environment variables to the name of the  folder which contains the java sdk

"Peterson, Elena S" <el...@pnl.gov> wrote:  Hello all,

I've searched and searched through the archive and cannot find an answer
to this particular question.  I have a simple build file with a javac
command.  I get this message when it runs:

BUILD FAILED
C:\eclipse\workspace\PQuad\build.xml:131: 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

So I checked to see what the value of java.home is and that's the part
that's confusing me.  Before any of the targets run it points to my jdk
(which is what the JAVA_HOME environment variable points to).  However
as soon as any target is called it points to a jre.

As you can tell from the error message I'm running this in eclipse 3.1.1
on a windows box.  I have none of the "other" ant environment variables
set.  Java is in my path (in the windows directory) but javac is not.

Any help/guidance you could provide me would be greatly appreciated.

Thanks,

Elena  

Elena S. Peterson
Senior Research Scientist II
Pacific Northwest National Laboratory
Elena@pnl.gov



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




		
---------------------------------
Find your next car at Yahoo! Canada Autos