IntelliJ ResolutionException on Java modules - contains package/exports package

Viewed 258

I wrote a Java module a.b.c and another module d.e.f that requires a.b.c. I'm using IntelliJ.

First module's module-info.java:

module a.b.c {
  exports a.b.c;
  requires org.jfree.jfreechart;
  requires commons.cli;
  requires java.desktop;
  requires java.net.http;
}

Second module's module-info.java:

module d.e.f {
    requires a.b.c;
    requires org.json;
}

Both modules compile. When I run d.e.f, I get the following error.

java.lang.module.ResolutionException: Module a.b.c contains package org.jfree.chart.ui, module org.jfree.jfreechart exports package org.jfree.chart.ui to a.b.c

These modules aren't split as there is no redundant package between them.

  • What does this message mean?
  • How do I resolve it?
1 Answers

I received the ResolutionException error because my IntelliJ project was not set up correctly. The best guidance I found was at Java 9 Modules with IntelliJ IDE Quick Start. Both modules now run without any compile- or run-time errors.

Related