idea java sdk找不到指定文件路径,由于新的文件夹结构,在Linux上的Intellij IDEA中正确设置Java 9作为SDK...

Before you write me off, please consider that neither of these are answers to my question:

In IntelliJ IDEA 2017.2.6, attempting to add JDK9 as an SDK passes but does not work as the classpaths end up empty. Steps to reproduce:

Open 'Add new SDK dialog'

(go to Project Settings > Project > Project SDK > New > JDK)

Select JDK 9

pSN8k.png

Passes, but if you look under SDK > JDK9 classpaths are empty and your code errors out due to base classes not being found. See image:

EwTxQ.png

In IntelliJ IDEA 2017.3 EAP you get an error about JDK classes not being found. See images below:

Open 'Add new SDK dialog'

(go to Project Settings > Project > Project SDK > New > JDK)

Select JDK 9

pSN8k.png

Should pass, but produces error popup

rzF9e.png

Command line compilation of HelloWorld example with jdk9 works as expected.

Linux version: they're using Mint 18, and I'm using Debian Stretch.

OpenJDK is the latest from the repo at the moment of writing: 9~b181-4~bpo9+1. Even though is the same version, it still does not work in my case.

I did not understand the answer from the comments though. Tried setting different names for JDK (9 and 1.9) but it still did not show modules instead of classpaths and classpaths remained empty.

解决方案

Current debian binary package openjdk-9-jre-headless 9~b181-4 contains incorrectly compiled lib/jrt-fs.jar file.

There are 2 filed issues separately on both idea youtrack and also ubuntu launchpad.

As it is indicated here:

Probable reason:

Classes in lib/jrt-fs.jar were compiled by Java 9 with options "-source 8"/"target 8". They should be compiled with "--release 8" option instead (or by Java 8)

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

You may also try to recompile the openjdk-9 source using the advised option "--release 8".

Anyway I advice to vote up this issue on the above link to attract more attention by dev team.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值