Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I wanted to make a custom doclet for JavaDoc and i initially tried to use the com.sun.javadoc package for this application. I was successfully able to create a doclet and use it with JDK8, but doing this with JDK12 gives me a warning that this class is deprecated and would be soon out of support.

I tried the same doclet with JavaDoc on another computer with OpenJDK15 (running java --version gave me the following output:)

openjdk 15.0.1 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9-18)
OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

and it is really out of support :( I could not use it and it gave me a message saying that this doclet is not supported.

After some research, i found that the new jdk uses the jdk.javadoc.doclet API to create doclets. i created a basic doclet using the above class that actually does nothing, just implemented all methods and tried to compile, but the compiler gave me an error saying that package jdk.javadoc.doclet does not exist.

I use IntelliJ as my IDE but it doesn't show any error through it's IntelliSense. IntelliJ believes that the package exists and even provides me code highlighting for the methods in the classes of that package.

Hey @Abra , I know that com.sun.javadoc has been deprecated but It was working when I was using jdk8. Now, I want to migrate to later versions of JDK and for that I need to use jdk.javadoc.doclet which is causing an error. The IDE recognizes it as available but at the time of compiling, it shows that the package doesnt exist. – Nalin Angrish Jan 12, 2021 at 12:38 Do you use Maven/gradle in project? Does it make a difference change the Settings (Preferences on macOS) | Build, Execution, Deployment | Compiler | Java Compiler | Use '--release' option for cross-compilation (Java 9 and later) option? – Andrey Jan 12, 2021 at 14:43

Please make sure that the JDK in your development IDE, ie Eclipse, Intellij, uses the same one as your PATH variable does. You can verify this by checking the properties of the corresponding settings of the IDE. Probably it might so happen that you have multiple version of JDK installed on your PC and the one your development ide uses is different than the one from the system one. Having such a problem will create problems inside the IDE, when compiling your source code.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.