java 缺少库 com.sun.tools.attach

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11901156/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 06:50:52  来源:igfitidea点击:

Missing Library com.sun.tools.attach

javavirtual-machinejdk-tools

提问by alicjasalamon

I've tried to follow this tutorial, but I have problem with imports.

我尝试按照本教程进行操作,但在导入时遇到问题。

I got:

我有:

The import com.sun.tools cannot be resolved

in line

排队

import com.sun.tools.attach.VirtualMachine;

I've tried to look for some info on Sun/Oracle website, but I have not found anything helpful.

我试图在 Sun/Oracle 网站上查找一些信息,但没有找到任何有用的信息。

I am developing on JDK 1.6.0_31.

我正在 JDK 1.6.0_31 上开发。

回答by Nathan

tools.jarneeds to be added to the IDE's library path and the program's classpath. The tools.jarfile is found in the JDK's libdirectory.

tools.jar需要添加到 IDE 的库路径和程序的类路径中。该tools.jar文件位于 JDK 的lib目录中。

For example, if the JDK were installed into C:\Program Files\Java\jdk1.7.0_11then the tools.jarfile will be found at C:\Program Files\Java\jdk1.7.0_11\lib\tools.jar.

例如,如果安装了 JDK,C:\Program Files\Java\jdk1.7.0_11那么该tools.jar文件将位于C:\Program Files\Java\jdk1.7.0_11\lib\tools.jar.

回答by Roman C

You should add tools.jarto your classpath.

您应该添加tools.jar到您的classpath.

回答by amicngh