4

I recently installed openJDK 9 under Ubuntu 17.10 and it seems like IntelliJ IDEA has trouble with it.

Whenever I create a new project IntelliJ can find the JDK, but it seems like it's not configuring it the right way. Here is how it looks like

Project Structure

when I create a HelloWorld.java example it looks like this

HelloWorld

and it says 'Can't resolve symbol 'String''.

Everything works fine when I compile via terminal and even with Eclipse.

When I type 'java --version' it says

openjdk 9-Ubuntu

OpenJDK Runtime Environment (build 9-Ubuntu+0-9b181-4)

OpenJDK 64-Bit Server VM (build 9-Ubuntu+0-9b181-4, mixed mode)

Is there a way to fix this problem?

Community
  • 1
  • 1
  • I don't use Ubuntu but "/usr/bin/jvm" seems wrong. Look for a different directory, maybe just under "/usr/bin/" ("/usr/bin/java" for example). – markspace Nov 17 '17 at 18:44
  • 1
    Can you verify the path to your JDK home is valid i.e. inspect the directory manually? – D-Dᴙum Nov 17 '17 at 18:45
  • Also perhaps check with `update-alternatives --config java`. – D-Dᴙum Nov 17 '17 at 18:48
  • 2
    Related thread already open for this https://stackoverflow.com/questions/47296429/how-to-properlly-setup-jdk9-as-sdk-in-intellij-idea-on-linux-due-to-new-folder-s – Naman Nov 17 '17 at 20:02
  • @Kerry I checked the path manually and it’s correct. I’ll try openjdk 8 and see if it’s working. I used to have oracle jdk which worked fine but after setting up a fresh install of ubuntu 17.10 I wanted to try openjdk. –  Nov 17 '17 at 21:06
  • @jslr Agreed. But ideally this/that shall get closed as a dupe. Its better to upvote an existing question if you are about to ask the same. – Naman Nov 17 '17 at 21:21

1 Answers1

0

The problem is related to Debian packaging of openjdk-9 in the lib/jrt-fs.jar file. This file is compiled incorrectly.
This bug is reported here and there is a more complete Answer here.

If you insist to make use of openjdk you might wait for the new versions or try to build it from the source using the recommended options on the launchpad.

Kayvan Tehrani
  • 3,070
  • 2
  • 32
  • 46