user297850 user297850 - 7 months ago 17
Java Question

which one should JAVA_HOME to point, JDK or JRE

I pointed the JAVA_HOME to C:\Program Files (x86)\Java\jre7 It works fine. Afterwards, I unzipped ant and set up the environment variables related to Ant, I got the following error messages after typing "ant -version"

image

I searched this forum. Looks like one solution i to point Java to JDK instead of JRE. I am not exactly sure whether this should be the solution. In other words, in general, which one should JAVA_HOME point to JDK or JRE?

Answer

If you're doing any sort of development, or building with Maven or Ant, you need to point to the JDK (Java Development Kit) where utilities such as javac (the Java Compiler) reside. Otherwise, you can point to the JRE (Java Runtime Environment).

The JDK contains everything the JRE has and more. If you're just executing Java programs, you can point to either the JRE or the JDK.