简体   繁体   English

在java8中找不到java.util.stream

[英]Can't find java.util.stream in java8

I have installed jdk-8-ea-bin-b82-windows-x64-21_mar_2013 and IntelliJ IDEA 12.0.4 . 我安装了jdk-8-ea-bin-b82-windows-x64-21_mar_2013IntelliJ IDEA 12.0.4 The strange thing is that I can't find java.util.stream in the intellisense provided by the IDE. 奇怪的是我在IDE提供的intellisense中找不到java.util.stream I tried to compile either using the IDE or using the notepad and the compiler but it gives an error complaining that java.util.stream cannot be found! 我尝试使用IDE或使用记事本和编译器进行编译,但它提出错误抱怨java.util.stream无法找到! I have already set the module settings to use Java8 jdk. 我已经将模块设置设置为使用Java8 jdk。 Any ideas about this problem? 关于这个问题的任何想法?

I had the same problem with Netbeans. 我和Netbeans有同样的问题。 It seams that older versions of JDK 8 are not correctly packaged. 它接缝是旧版本的JDK 8未正确打包。

I had the same problem with b84, but I installed the build b116 and it is working properly. 我遇到了与b84相同的问题,但我安装了构建版本b116,它运行正常。

PS: I think this is what @rmuller said in his comment PS:我认为这是@rmuller在评论中所说的

To change the JDK version, go to File --> Project Structure, and make sure both Project SDK and Project Language Level are set to JDK 8. 要更改JDK版本,请转到文件 - >项目结构,并确保Project SDK和Project Language Level都设置为JDK 8。

(I know you said you set the JDK level in the modules already, but I'm posting this here because there is relatively little information online on how to do that. Even the IDEA documentation on this issue doesn't mention it!) (我知道你说你已经在模块中设置了JDK级别,但是我在这里发布了这个,因为在线上关于如何做到这一点的信息相对较少。即使是关于这个问题的IDEA文档也没有提到它!)

尝试从以下网址下载: http//jdk8.java.net/lambda/以获得lambda和stream支持

As @rmuller pointed out there was no streams in the early release version that I have downloaded 5 years ago when I asked the question. 正如@rmuller所指出的那样,5年前我在问这个问题时已经下载的早期版本中没有流。 Short while after I asked the question a new release was available and it contained the streams support. 在我提出问题之后不久,有一个新版本可用,它包含了流支持。

YOU CAN SET PROJECT SETTING IN MODULES 您可以在模块中设置项目设置

THE LANGUAGE LEVEL SET 8-LAMBDAS enter image description here 语言水平集8-LAMBDAS 在此处输入图像描述

BEACUSE THE DEFAULT LANGUAGE LEVEL IS 7 -Diamonds 原来默认语言水平是7 -Diamonds

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM