Using local OpenJDK build as SDK


I have cloned and built (with "make images") a local OpenJDK ("amber" repository). When I try to add the resulting build//images/jdk directory as an SDK, IntelliJIdea does not complain about the directory structure (so it correctly identifies it as a modular JDK), but the Classpath tab is blank, so the resulting configuration is unusable. If I manually add the JDK modules at build//images/jdk/jmods, they show up as ordinary files and are not scanned as module files.
I assume this works for other people, so what am I doing wrong? Wrong build target? Wrong JDK directory? (Note that I am not trying to start IntelliJIdea with an OpenJDK build, just use my local build as a project JDK.)


Please try with 2017.3 from If does not help, please post content of idea.log file starting from IDE restart and reproducing the problem.


Hi Andrey,

I should have said, I'm already using the latest EAP build.  There is nothing written in the idea.log file when I add an SDK (and no errors on the screen).

The SDK is correctly identified as a JDK 10 build, the Sourcepath is found as build/<platform>/images/jdk/lib/!/ (etc.), but I'm 'just' missing the Classpath


Same problem on both my Windows 7 and OS X (with a clone of the same repository, I'll have a look with the utility linked in the bug.


Hi Robert,

I tried to create a JDK from a fresh build of Amber repository, and got the following in the log: Error mounting JRT filesystem at /home/sher/Tools/jdk-amber
    at com.intellij.openapi.vfs.impl.jrt.JrtHandler.getFileSystem(
    at com.intellij.openapi.vfs.impl.jrt.JrtHandler.createEntriesMap(
Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
    at jdk.internal.jimage.BasicImageReader.slice(
    at jdk.internal.jimage.BasicImageReader.intBuffer(
    at jdk.internal.jimage.BasicImageReader.<init>(
    at jdk.internal.jimage.ImageReader$SharedImageReader.<init>(
    at jdk.internal.jimage.ImageReader$
    at jdk.internal.jrtfs.JrtFileSystem.<init>(
    at jdk.internal.jrtfs.JrtFileSystemProvider.newFileSystem(
    at java.nio.file.FileSystems.newFileSystem(
    at com.intellij.openapi.vfs.impl.jrt.JrtHandler.getFileSystem(
    ... 73 more

The problem is the same as in IDEA-179481 - since the IDE is unable to load lib/jrt-fs.jar, it can't enumerate the modules.

Substituting lib/jrt-fs.jar with the one copied from JDK 9 fixes the exception. Unfortunately, a negative result is already cached, so one has to delete the incomplete JDK definition, perform File | Invalidate Caches, and restart the IDE. Adding a JDK should work after that.


Yes, that was it, thanks.  I didn't see the error messages in my log because the bad results were already cached from earlier attempts.


Please sign in to leave a comment.