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

来源:互联网 发布:win8网络打印机连不上 编辑:程序博客网 时间:2024/04/25 12:31
今天装了MyEclipse_5.5.1GA_E3.2.2_FullStackInstaller.exe,这个MyEclipse5.5是自带eclipse的,而且还自带了个名为MyEclipse 5.5.1 GA的JRE:


安装完成,建了个webproject,写了个简单jsp来测试,结果出现如下错误:
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

于是把jdk的lib目录下的tools.jar拷到tomcat的common目录下,重启tomcat,问题依旧。
然后添加了一个JRE,并设置tomcat的jdk为此jre如图:


再使用Server View来重启tomcat,问题解决。
奇怪的是我再把tomcat的jdk改回为MyEclipse 5.5.1 GA,并没有出错。