简体   繁体   English

如何在Eclipse氧气中设置java 10?

[英]How to set up java 10 in Eclipse Oxygen?

I am not sure if latest version of eclipse ie Oxygen supports java 10 or not.我不确定 eclipse ie Oxygen 的最新版本是否支持 java 10。 I configured the JRE for java 10 from preferences on my mac machine.我从我的 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 this post 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 )开始工作,但当我尝试运行该应用程序时它仍然失败。

So, I requested eclipse to look into it and see why the patch don't work. 所以,我请求eclipse查看它,看看为什么补丁不起作用。

Here is 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. 它原本打算安装在4.7.3版本之上。 Now, the Java 10 support is available on the downloads page via the 4.7.3a builds. 现在,可以通过4.7.3a版本在下载页面上获得Java 10支持。 The earliest build that is supporting this feature can be downloaded from 可以从中下载支持此功能的最早版本

So download the supporting build from here . 所以从这里下载支持的版本。 And see the new features of Eclipse with java 10 here . 而看到Eclipse中的新功能,用java 10 在这里

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

The Eclipse IDE versions, and supported Java versions by IDE, listed over here: Eclipse IDE 版本,以及 IDE 支持的 Java 版本,在这里列出:

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

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