如何在 Eclipse Oxygen 中设置 java 10?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49436841/
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
How to set up java 10 in Eclipse Oxygen?
提问by Vinay Prajapati
I am not sure if latest version of eclipse i.e. Oxygen supports java 10 or not. I configured the JRE for java 10 from preferences on my mac machine.
我不确定最新版本的 eclipse ie Oxygen 是否支持 java 10。我从我的 mac 机器上的首选项为 java 10 配置了 JRE。
Also, I tried adding maven compiler plugin as below to my pom.xml:-
另外,我尝试将 maven 编译器插件如下添加到我的 pom.xml:-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
<compilerVersion>10</compilerVersion>
<fork>true</fork>
<executable>/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home</executable>
</configuration>
</plugin>
I also tried after setting the Run Configurations as below:-
我在设置运行配置后也尝试过:-
Anybody knows how could I make it work for java-10.
任何人都知道我如何使它适用于 java-10。
I tried running code below:-
我尝试在下面运行代码:-
public class App {
public static void main(String[] args) {
var list = new ArrayList<String>();
System.out.println("Hello World!");
}
}
Update:-I applied the suggested patch in comment and it still fails.
更新:-我在评论中应用了建议的补丁,但它仍然失败。
Screenshot below:-
截图如下:-
Also, I followed thispost to make it compile. So, compilation actually worked from eclipse (maven install
) but it still fails when I try to run the application.
另外,我按照这篇文章进行了编译。因此,编译实际上是从 eclipse ( maven install
) 开始的,但是当我尝试运行该应用程序时它仍然失败。
采纳答案by Vinay Prajapati
So, I requested eclipse to look into it and see why the patch don't work.
所以,我要求 eclipse 调查一下,看看为什么补丁不起作用。
Hereis the answer I got
这是我得到的答案
Below is the exact comment from Eclipse community:-
以下是来自 Eclipse 社区的确切评论:-
Note:This feature patch is disabled. It was originally intended to be installed on top of 4.7.3 builds. Now, the Java 10 support is available on the downloads page via the 4.7.3a builds. The earliest build that is supporting this feature can be downloaded from
注意:此功能补丁已禁用。它最初打算安装在 4.7.3 版本之上。现在,Java 10 支持可通过 4.7.3a 版本在下载页面上获得。可以从以下位置下载支持此功能的最早版本
So download the supporting build from here. And see the new features of Eclipse with java 10 here.
所以从这里下载支持版本。并在此处查看带有 java 10 的 Eclipse 的新功能。
Hope it helps!
希望能帮助到你!
Edit:The patch support was temporary and has been removed. So, now you need to install the latest eclipse version and it's having the support for java 10
编辑:补丁支持是暂时的,已被删除。所以,现在你需要安装最新的 eclipse 版本并且它支持 java 10