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

后端 未结 1 1195
遥遥无期
遥遥无期 2021-01-13 10:48

I am using Intellij IDEA 2017.2.5 on Linux Mint 18.2 and trying to add new openjdk-9 SDK but IDEA does not accept openjdk

相关标签:
1条回答
  • 2021-01-13 11:28

    “ 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

    0 讨论(0)
提交回复
热议问题