ANT错误com.sun.tools.javac.Main is not on the classpath

ANT异常com.sun.tools.javac.Main is not on the classpathant编译java源代码时报错:?com.sun.tools.javac

ANT异常com.sun.tools.javac.Main is not on the classpath

ant编译java源代码时报错:

?

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\Java\jre6"

?

baidu了一下

电脑上有多个JDK版本,或者是JDK版本设置混乱的原因,或者JRE、JDK....

解决:

将jdk\lib中的tools.lib拷贝到jre\lib中即可(jre中没有这个jar)

?

具体原因希望知道的高人说一下,谢谢~