Module jdk.compiler does not “opens com.sun.tools.javac.processing” to unnamed module

Error:
The module jdk.compiler does not open the package com.sun.tools.javac.processing to the unnamed module.
Explanation:
In the Java 9 module system, when a module wants to allow another module to access its packages, it needs to explicitly open those packages using the opens directive in the module declaration.
In your case, the jdk.compiler module has not opened the package com.sun.tools.javac.processing to the unnamed module, which is causing the error.
Example:
Let’s say we have two modules: moduleA and moduleB. If moduleA wants to allow moduleB to access its packages, it needs to open those packages in its module declaration.

// module-info.java file of moduleA
module moduleA {
    opens com.example.packageA to moduleB;
}
This will allow moduleB to access the packages in com.example.packageA from moduleA.

Related Post

Leave a comment