导入 com.sun.javadoc 无法在 Eclipse 中解析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3386344/
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
The import com.sun.javadoc cannot be resolved in Eclipse
提问by folone
I'm having problem compiling a project in Eclipse.
我在 Eclipse 中编译项目时遇到问题。
The import com.sun.javadoc cannot be resolved
I added tools.jar as an external jar, changed default compiler to use jdk instead of jre, did Project -> Clean afterwards. But nothing of this helped. What am I missing here?
我将 tools.jar 添加为外部 jar,将默认编译器更改为使用 jdk 而不是 jre,然后执行 Project -> Clean。但这些都没有帮助。我在这里错过了什么?
UPD:this is how it looks like (packages exist on the left, but not seen on the right): alt text http://3593.iz.piccy.info.nyud.net/i5/93/35/353593/lol.gif
UPD:这就是它的样子(左边有包,但右边看不到): alt text http://3593.iz.piccy.info.nyud.net/i5/93/35/353593/lol .gif
采纳答案by Vineet Reynolds
There's a typo. If you're attempting to run javadoc programmatically, you need to use
有一个错字。如果您尝试以编程方式运行javadoc,则需要使用
com.sun.tools.javadoc.Main
com.sun.tools.javadoc.Main
and not
并不是
com.sun.javadoc.Main.
com.sun.javadoc.Main。
回答by mike g
It is probably because there are 'restriction' rules on the jar you are importing.
这可能是因为您要导入的 jar 有“限制”规则。
These can be disabled by disabling them. Either globally or just on the necessary project.
这些可以通过禁用它们来禁用。无论是在全球范围内,还是在必要的项目上。
Should be something like:-
应该是这样的:-
- Right click on project
- Select 'Project Properties'
- Select page 'Java Compiler->Error/Warnings'
- Enable project specific settings
- Deprecated and restricted API->Forbidden reference (access rules). ---> set to 'ignore'
- 右键单击项目
- 选择“项目属性”
- 选择页面“Java Compiler->Error/Warnings”
- 启用项目特定设置
- 已弃用和受限的 API-> 禁止引用(访问规则)。---> 设置为“忽略”