• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDK home directory problem

 
Nagendra Shastry
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All,

I have my java folder in C:\Program Files (x86). When I try to build project in eclipse using ant it is telling

BUILD FAILED
D:\EVENTS_DB\b2b2-ear\build.xml:97: 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 "C:\Program Files (x86)\Java\jre6"

My JAVA_HOME variable is set as C:\Program Files (x86)\Java;

What is the probelm?
 
Luke Leber
Ranch Hand
Posts: 69
2
C++ Linux Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAVA_HOME should point to the top level directory of your JDK installation (which is not the same as your JRE installation). In my case, it is "C:\Program Files\Java\jdk1.7.0_40".

Since you're using ant, I should let you know another little trick that I've picked up with it. The ant build process will exit without letting you see the terminal output. To add in a pause at the end of execution, so you can actually see the output, you can modify ANT_HOME/bin/ant.bat all the way at the bottom of the file as follows...



Just insert the pause in the omega block label before exit and you're set.

Hope it helps!
 
Jay Tai
Ranch Hand
Posts: 221
Java MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The corect JAVA_HOME setting should point to your Java directory only. You can then manipulate sub directories (like bin, libs, etc) accordingly. Try removing the jre directory from your setting so that :

JAVA_HOME=C:\Program Files (x86)\Java
 
Doug Slavens
Greenhorn
Posts: 11
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At my workplace, we build and test against a number of different JRE/JDK versions and in our build scripts we always use the top level JDK directory in the JAVA_HOME variable as Luke mentioned above. Also, JREs don't come with a javac compiler so a JDK will be necessary to call the compiler.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic