java.util.Arrays 不工作 java 8
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24490663/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.util.Arrays not working java 8
提问by popgalop
I recently updated to using Java 8 on my computer for eclipse. I had previously been using Java 7. At first the update seemed to work fine as I could compile and run a simple hello world
-program. However, as I began to import previous projects that I had been working on that used the class java.util.Arrays
, I got an error like Arrays could not be resolved
. I have been having a similar problem with the PriorityQueue
class saying that,
我最近更新为在我的计算机上使用 Java 8 进行 Eclipse。我以前一直在使用 Java 7。起初更新似乎工作正常,因为我可以编译和运行一个简单的程序hello world
。但是,当我开始导入以前使用该类的项目时java.util.Arrays
,出现了类似Arrays could not be resolved
. 我一直在PriorityQueue
课堂上遇到类似的问题,说,
The type
java.util.Comparator
cannot be resolved. It is indirectly referenced from required.class
files.
类型
java.util.Comparator
无法解析。它是从所需.class
文件间接引用的。
回答by Baalthasarr
If you import previous Project then the Projects have the JDK for Java 7 in there Buildpath. You only have to update your Buildpathin the Projects to use Java 8. That should solve your problem.
如果您导入以前的项目,那么项目在 Buildpath 中有 Java 7 的 JDK。您只需更新项目中的 Buildpath 即可使用 Java 8。这应该可以解决您的问题。
Buildpaths don't will be updated automaticle for every Projects if you update your JDK.
如果您更新 JDK,则不会为每个项目自动更新构建路径。
回答by joshmcode
I ran into something really similar today. Not sure if its the same issue, but what I did was:
我今天遇到了非常相似的事情。不确定是否是同样的问题,但我所做的是:
Open project explorer
打开项目浏览器
Right click the project
右键单击项目
Find "Configure Build Path"
找到“配置构建路径”
In the window that opens, select the "Libraries" tab
在打开的窗口中,选择“库”选项卡
Scroll down to JRE System Library (there was a red error symbol next to mine) and click the library.
向下滚动到 JRE 系统库(我的旁边有一个红色错误符号)并单击该库。
In the top right, select the Edit button
在右上角,选择“编辑”按钮
Choose "Alternate JRE" and then pick (in your case) java 8
选择“Alternate JRE”,然后选择(在你的情况下)java 8