George
George

Reputation: 8378

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

Upvotes: 4

Views: 17193

Answers (2)

mike g
mike g

Reputation: 1791

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'

Upvotes: 2

Vineet Reynolds
Vineet Reynolds

Reputation: 76709

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.

Upvotes: 1

Related Questions