简体   繁体   中英

The import com.sun.javadoc cannot be resolved in Eclipse

I'm having problem compiling a project in 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?

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

It is probably because there are 'restriction' rules on the jar you are importing.

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'
  4. Enable project specific settings
  5. Deprecated and restricted API->Forbidden reference (access rules). ---> set to 'ignore'

There's a typo. If you're attempting to run javadoc programmatically , you need to use

com.sun.tools.javadoc.Main

and not

com.sun.javadoc.Main.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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