intelliJ doesn't accept java 9 JDK

Solution 1:

I had a similar problem but I got around it. Try this.

  1. Download Java JDK 9 zip or tar.gz (I used this so everything I say afterwards will reflect this).

  2. Once downloaded, extract the tar.gz file in your location of choice (please take note of the location, you will come back to it later).

  3. Open IntelliJ and go to Project Structure under Files. Under Project SDK, navigate to the location in 2. above and select it.

Alternatively, go to Files > Project Structure > Platform Settings. Once again, add the location in 2. above (green plus sign) if you do not see it in the pane.

I hope this will help you and you will enjoy Java 9 as well as jShell.

Solution 2:

I found it; it is probably not specific for Ubuntu, but it has to do with a jar (lib/jrt-fs.jar) that wasn't compiled correctly in openjdk-9..

the answer is here: https://stackoverflow.com/questions/47296429/properly-set-up-java-9-as-sdk-in-intellij-idea-on-linux-due-to-new-folder-struct/47850159#47850159

I quote: A temporary workaround may be replacing /usr/lib/jvm/java-9-openjdk-amd64/lib/jrt-fs.jar with the one from Oracle JDK.

After I replaced the jar I could add the SDK to IntelliJ without any problem.