• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDK home directory problem

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 69
2
Netbeans IDE C++ Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 11
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic