JRE系统库缺少tools.jar [英] JRE system library missing tools.jar

查看:785
本文介绍了JRE系统库缺少tools.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu 12.04(LTS)。在Eclipse项目中,我需要使用com.sun.tools.attach包。但是,我的JRE系统库不包含包含该软件包的tools.jar文件。

I am using Ubuntu 12.04(LTS). In my project in Eclipse I need to use the com.sun.tools.attach package. However, my JRE system library does not include the tools.jar file which contains the package.

我尝试为Java 6和7安装不同的JRE和JDK。他们中的libs文件夹中有提到的jar文件,但是在选择JRE后,Eclipse仍然无法将其包含在我的类路径中。引用tools.jar可以直接解决问题,但是由于这是一个共享项目,所以不允许我修改类路径,因此这对我而言不是可行的解决方案。

I tried installing different JREs and JDKs for both Java 6 and 7. What I noticed is that some of them have the mentioned jar file in their libs folder but Eclipse still fails to include it in my classpath upon selection of the JRE. Referencing tools.jar directly solves the problem but since this is a shared project I am not allowed to modify the classpath and thus this is not a viable solution for me.

我的朋友正在使用具有相同版本的Eclipse和默认JRE的MAC并没有此问题。我们发现对他来说,tools.jar是classes.jar的一部分,在我的设置中不是这种情况(无论如何我都没有classes.jar)。

My friend is using a MAC with the same version of Eclipse and the default JRE and does not have this problem. What we found out is that for him tools.jar is part of classes.jar which is not the case in my setup (I don't have classes.jar whatsoever).

做什么您认为这可能是此问题的根源吗?

What do you think might be the source of this problem?

推荐答案

问题是JDK包含tools.jar文件(这两个JRE都没有)。

解决问题很容易,您必须指定默认的运行时环境以用于项目或整个工作区。将其更改为任何已安装的JDK。

It is easy to solve the problem, you have to specify the default runtime environment to use either for the project or for the whole workspace. Change that to any of the installed JDKs.

最简单的方法可能是转到 Window-> Preferences-> Java-> Installed JREs ,然后选择JDK而不是JRE。默认情况下,所有项目都使用此设置。

The easiest way is probably going to Window --> Preferences --> Java --> Installed JREs, and selecting the JDK instead of the JRE. All the projects use this setting by default.

这篇关于JRE系统库缺少tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆