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
I was getting the same error in Mac OS X but all the answers I could find were for the Windows system and as the paths are a little different in both, those solutions weren't working for me. After spending hours on it, I was finally able to fix it in the following way:
Copy /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/tools.jar to /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext
It will work for Windows users too:
Copy C:\Program Files\Java\jdk1.8.0_91\lib\tools.jar to C:\Program Files\Java\jre8\lib\ext
P.S. Also take care that the versions for jdk and jre that you have selected in Eclipse are compatible.
Quick work around for the same is
Copy C:\Program Files\Java\jdk1.7.0_03\lib\tools.jar to C:\Program Files\Java\jre7\lib\
This exception is coming because JAVA_HOME is being set as C:\Program Files\Java\jre7 and Ant is not able to find tools.jar in it.