Search code examples
javaeclipsejavacjava-9

How to tell eclipse to add-exports when compiling


Is it possible to tell eclipse to add the following command line option: --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED when compiling.

I think it may also be needed when running tests.

Is it also possible to remove this message: enter image description here

Note that I tried to add those to the VM options of one of my unit tests but that did not work.


Solution

  • Update: In the Java Build Path settings, there is now a tab Modules Dependencies for this. The screenshot below refers to an older versions of Eclipse.

    1. Go to Project > Properties: Java Build Path, tab Libraries
    2. Select the JRE > Is modular node and click Edit...
    3. Go to the tab Details
    4. In the Added exports section click Add...
    5. Enter the following:
    • Source module: jdk.compiler
    • Package: com.sun.tools.javac.tree

    enter image description here