Intellij IDEA 2017.2 can't add openjk 9 on Linux Mint 18

回眸只為那壹抹淺笑 提交于 2019-12-01 05:26:23

“ Ubuntu PPA for OpenJDK” currently has very old build of openjdk-9(9~b115-1ubuntu1).
So the IDEA does not recognize it as a valid SDK.
I removed current installed version:

sudo apt-get remove '^openjdk-9.*'

Then I have downloaded newer .deb build(9~b181) files including jre,jre-headless,... from launchpad build archive.

sudo dpkg -i openjdk-9-jre-headless_9_b181-4_amd64.deb  
             openjdk-9-jre_9_b181-4_amd64.deb 
             openjdk-9-jdk-headless_9_b181-4_amd64.deb 
             openjdk-9-jdk_9_b181-4_amd64.deb

Just Execute the above command at a single line, line breaks are for better readability.

Ignore any error complaining about:

"Package libpng16-16 is not installed."

Next execute the following:

  sudo apt-get install -f

Now after installing this build of openjdk-9 the IDEA is happy with SDK home.

Thanks @y.bedrov for his useful comment.

Update: However this solution enables you to declare openjdk-9 in the mentioned IDEA version(2017-2) but you are not able to compile any class within the IDEA itself. You can only compile your application with elder jdk and run it with openjdk-9. There is an other issue which indicates this here.

In the newer IDEA versions(I have tested 2017.3) this build of openjdk is not allowed to be used as new SDK any more, see this issue.

The short reason is an issue in Debian package which contains incorrectly compiled lib/jrt-fs.jar file.

See this Answer for more information

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!