Getting "java: package com.sun.javadoc does not exist" while building the project in IntelliJ

1.7k Views Asked by At

Hii I have been facing error while building the project in IntelliJ. My laptop is MacBook M1 Pro. My Java version is "11.0.14" and my language level is 11. When I build this in intellij it fails with this error saying "java: package com.sun.javadoc does not exist". But while building in maven on the terminal i.e, on the command line with the same java version and language level it works fine and it builds successfully.

Any help for resolving this error. Thanks.

build error

project structure

1

There are 1 best solutions below

0
On

When Java version problems occur try checking out 3 things:

  1. File -> Project structure -> Project -> Language Version (as I see, in your project everything's ok)
  2. File -> Project structure -> Modules -> Language Version (must be 11)like this
  3. File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Target bytecode version (must be 11)like this

After all try restarting IDE.