Unable to compile modules with references to automatic modules - "cannot find module: jdk.management.resource"

Florian Troßbach florian.trossbach at codecentric.de
Sun Nov 8 09:56:59 UTC 2015

Hi Alan,

Thank you for your answer, building the JDK myself this error goes away.
Building my own JDK was not without challenges on OSX Mavericks though:

I first mistakenly cloned the wrong repository (the JDK9 without Jigsaw. It
compiled just fine, but I of course discovered my error when javac
complained about the -modulepath switch.
Then I cloned the right repo, but it failed to compile with an “error 2”.
As I don’t know much about make, I proceeded to creating an Ubuntu VM and
after installing a load of dependencies (which the configure.sh script
tells you about very nicely!), I got it working.

I did some more “research" about the OSX build though, and i found this:
https://www.mail-archive.com/build-dev@openjdk.java.net/msg15343.html. This
prompted me to replace the offending sections
from /hotspot/make/bsd/makefiles/gcc.make (around line 324) with the
equivalent from the non-jigsaw sources that I managed to compile
successfully. Lo and behold, this worked like a charm.

Best regards,

2015-11-07 15:34 GMT+01:00 Alan Bateman <Alan.Bateman at oracle.com>:

> On 07/11/2015 10:15, Florian Troßbach wrote:
>> :
>> When I compile my modules with
>> javac -d . -mp ../jars -modulesourcepath . -verbose   $(find . -name
>> "*.java")
>> I get the attached output. The raised error is "error: cannot find module:
>> jdk.management.resource”.
>> This is a bug in the EA build where they are qualified exports to
> jdk.management.resource but this module is not in the builds. So it's a
> build issue, I'll create a bug to track this.  If you build the JDK
> yourself, from the jigsaw/jake sources, then you won't run into this issue,
> it is specified to how the EA builds are created.
> That said, I'm not 100% sure why javac runs into it here, I'm sure Jon or
> Jan can explain that.
> -Alan.

More information about the jigsaw-dev mailing list