Cannot find the system java compiler. Check that your class path includes tools.jar报错处理

今天启动项目的时候中遇到

java.lang.illegalstateexception:Cannot find the system java compiler. Check that your class path includes tools.jar

主要原因是因为编译器在编译时找不到 tools.jar

解决方案一:将%JAVA_HOME%\lib\tools.jar文件复制到%JAVA_HOME%\jre\lib\目录下

解决方案二: 右击所有project下的JRE System Libray-->Properties,在出来的界面上,点击Installed JREs-->选中目录如C:\Program Files\Java\jre1.8.0_60,在弹出的界面中点击add External JARs,将jdk-lib-tools.jar加进去即可。

解决方案三:打开你eclipse---window--preferences--Installed JREs      Edit打对号的jre,把JRE home的路径改为jdk路径

?

我遇到的就是第三种情况,项目在运行时需要访问tools.jar,这个访问是通过你配置的jre路径来访问并不是单纯的加载jar包,所以第一二种方案并不适用。

一般的项目运行只需要运行时环境jre就够了,有些特殊的需要用到开发环境jdk,两种环境还是有区别的,比如今天遇到问题tools.jar在jre环境中就找不到

原文地址:https://www.cnblogs.com/wangyongheng/p/9374029.html

时间: 2024-08-29 21:31:26

Cannot find the system java compiler. Check that your class path includes tools.jar报错处理的相关文章

Intellij编译时报“java: System Java Compiler was not found in classpath” 解决办法

Intellij编译时报“java: System Java Compiler was not found in classpath” 解决方法: Project Settings > Compiler > Java Compiler changed the drop down Use compiler from Javac to Eclipse!

Intellij编译时报“java: System Java Compiler was not found in classpath”

问题如下: http://stackoverflow.com/questions/19889145/setting-up-intellij-12-idea-with-java-1-7-and-resolve-java-system-java-compile IntelliJ 12 CE downloaded and installed Latest Java 1.7 downloaded and installed JDK was setup to make and run the projec

Tomcat启动报错java.net.AbstractPlainSocketImpl(java/net/AbstractPlainSocketImpl.java:178:-1)Struts在网络复杂情况下启动报错解决办法

SSH项目 在网络复杂的情况(具体规律未知)下,Tomcat启动时,报如下错误: [ERROR] 2014-08-12 14:52:58,484 [org.apache.struts2.dispatcher.Dispatcher :27] - Dispatcher initialization failedUnable to load configuration. - Class: java.net.AbstractPlainSocketImplFile: AbstractPlainSocket

Java:延迟功能的Robot在Lunix系统上会报错

Java:延迟功能的Robot在Lunix系统上会报错 关于延迟功能的Robot: 今天开发过程中发现,本机开发好的项目,部署到Lunix服务器竟然报错!查了代码发现: Robot r = new Robot(); //延时执行 r.delay(8000); 这个延迟函数,在Lunix上会报异常: 更改为: //延时执行 Thread.currentThread().sleep(8000);//毫秒 解决问题,Lunix上也是飞快的跑起来. 原文地址:https://www.cnblogs.co

java.sql.SQLException: Unknown column 'user0_.user_name' in 'field list' 报错问题

报错信息: java.sql.SQLException: Unknown column 'user0_.user_name' in 'field list'Query is: select user0_.id as id1_0_, user0_.user_name as user_nam2_0_, user0_.password as password3_0_ from user user0_java thread: http-nio-8881-exec-1 Hibernate报错:说表里没有u

Access restriction:The type JPEGCodec is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar 报错

报错: Access restriction:The type JPEGCodec is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar   解决方法: Project -> Properties -> libraries, 先remove掉JRE System Library,然后再Add Library重新加入. 将jre项目用自己下载的jre

Java解析JSON时,new JSONObject("这儿写json字符串")报错问题

在获取json字符串后Java使用api创建json对象报错,查阅资料解决该问题: 问题原因:net.sf.json.jsonobject 没有 new JSONObject(String)的构造方法 解决方法:更换jar包或者更换实例构造方法 1 String str="{\"users\":[{\"loginname\":\"zw\",\"email\":\"[email protected]\&quo

java 文件切割,为什么在关闭流的时候报错,51行

1 package java_IO.Test_1.File_Split_and_SequeceDemo; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileOutputStream; 6 import java.io.IOException; 7 8 public class FileSplit { 9 10 private File file; 11 private int size;

java.lang.NoClassDefFoundError: org/springframework/core/ErrorCoded,分布式项目报错

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError: org/springframework/core/ErrorCoded at java.lang.ClassLoader.defineClass1(Native Metho