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

15,379

Solution 1

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.

Solution 2

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'
Share:
15,379
George
Author by

George

I work on backends at Twitter

Updated on June 04, 2022

Comments

  • George
    George almost 2 years

    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