IntelliJ failign to find/losing references to SDK classes when I use JDK9 as the SDK

Answered

When I configure a JDK9 early access release as a platform or module SDK in IntelliJ it fails to resolve references to Java runtime (JRT)  classes from the relevant module code. They appear underlined in red and the help pop-up suggests that they are unknown classes and included 'Set up JDK' as one of the possible fix actions. Of course, this also means that it wil not open sourec files located in the associated src.zip file.

The External Libraries node in the project tree includes a reference to the relevant SDK as a subnode and below that has a JRT Node which displays all the packages and classes. However, the class entries only show as a .class file. The source tab in the Library Settings points at a correct src.zip file but it seems the classes are not being recognised nor are they being associated wiht these sources.

Interestingly, when I built my own JDK9 /debug/ image and installed it as a new SDK the classes were successfully resolved and sources were found. However, this was only temporary and at some point IntelliJ reconfigured and stopped being able to resolve links to JRT classes. Also, of relevance, perhaps, is that this never happened with a JDK9 product build. Of course, that may just be a red herring (since both builds are not that different as far as the SDK element of the build is concerned -- class files and src.zip are essentially the same).

Anyone have any idea why this is happening and what I can do to fix it?

5 comments
Comment actions Permalink

Hi Serge,

Thanks for offering to help. I'm currently using IDEA 2016.2 with build id IU-145-972. Is the above release different to that?

regards,

 

Andrew Dinn

 

 

0
Comment actions Permalink

Yes, it's different: build 162.426.1

0
Comment actions Permalink

Ok, thanks. I'm downloading now and will report back on what success I have.

regards,

 

Andrew Dinn

0
Comment actions Permalink

HI Serge,

JDK9 support appears to be working fine now. Thanks very much for your help.

regards,

 

Andrew Dinn

 

0

Please sign in to leave a comment.