I am trying to run some Java EE examples. Ant is suggesting: Perhaps JAVA_HOME does not point to the JDK. It is currently set to \"C:\\Program Files\\Java\\jre7
For eclipse
When you have both JRE and JDK installed in your system, please make sure JDK comes first in your PATH variable.
I think system scans the PATH variable from left to right, whatever comes first is taken into consideration.
In my case (with LinuxMint ) I was getting the same error. When I added JDK in PATH variable before JRE , it solved my problem.
When you click on the next button in the JRE Type window after selecting Standard VM you go to the next window named JRE Definition where you can find the Directory button.
In windows, go to computer properties, advanced system settings, advanced, environment variables
Add a system variable called "JAVA_HOME" set its folder to your JDK location in my case "C:\Program Files\Java\jdk1.7.0_51"
Close command prompt, reopen it and it should work now.
This worked for me. Even after adding tools.jar if it shows that javac not found. Click on run-> external tools configuration -> jre -> seperate JRE make sure points to jdk -> apply -> run And then run the build.xml file Jusy make sure in installed jre you are pointing to jdk location. Hope this helps
Got this error in Ant command line on Windows 7 x64 system.
Below change fixed the issue
Installed JDK from Oracle servers and then added a new system variable JAVA_HOME with value C:\Program Files\Java\jdk1.8.0_131