Eclipse使用Ant编译时报错Perhaps JAVA_HOME does not point to the JDK

Ant编译时报错,内容如下:

com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "D:\Java_Tools\Java\jre7"

解决,需要指定Eclipse编译时JREs,根据提示,应指定到JDK

如下图,点击window--> preferences--> Java --> Installed JREs ,点击Add,选择电脑中安装的jdk路径,此处选择jdk路径而不是jre路径,然后勾选新增加的jdk,确定,重新编译即可。

Eclipse使用Ant编译时报错Perhaps JAVA_HOME does not point to the JDK