This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have my java folder in C:\Program Files (x86). When I try to build project in eclipse using ant it is telling
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;
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.
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 :
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.