- Exception in thread "main" cn.com.tarena.exam.exception.RunAntException: Unable to find a javac compiler;
- 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/jdk1.6.0/jre"
- at cn.com.tarena.exam.util.AntUtil.distJar(AntUtil.java:149)
- at cn.com.tarena.exam.test.AntUtilTest.main(AntUtilTest.java:22)
在windows->preferences->ant-> Runtime->Classpath->Ant Home Enties Add Jars中,添加了jdk下面的/lib/tools.jar后,编译通过。原来com.sun.tools.javac.Main在这个 tools.jar中。
解决方法2:
右击工程选择工程的“Properties”-->Build Path-->JRE System Libary (双击) -->Installed JREs -->修改你的JRE
--->在修改页面将JDK和JRE目录中的所以jar包都要加进去。