简体   繁体   English

导入com.sun.javadoc无法在Eclipse中解析

[英]The import com.sun.javadoc cannot be resolved in Eclipse

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. 我添加了tools.jar作为外部jar,更改了默认编译器以使用jdk而不是jre,之后做Project - > Clean。 But nothing of this helped. 但这没有任何帮助。 What am I missing here? 我在这里错过了什么?

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注意

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:- 应该是这样的: -

  1. Right click on project 右键单击项目
  2. Select 'Project Properties' 选择“项目属性”
  3. Select page 'Java Compiler->Error/Warnings' 选择页面'Java Compiler-> Error / Warnings'
  4. Enable project specific settings 启用项目特定设置
  5. Deprecated and restricted API->Forbidden reference (access rules). 弃用和限制API->禁止参考(访问规则)。 ---> set to 'ignore' --->设置为'忽略'

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。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM