在Eclipse中编写Java 8 [英] Programming Java 8 in Eclipse

查看:134
本文介绍了在Eclipse中编写Java 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在分支机构( http://wiki.eclipse)中正在开发针对Java 8的Eclipse支持。 org / JDT_Core / Java8 )。

为了尝试当前的Java支持Java 8,我做了以下工作:

To try out the current Eclipse support for Java 8, I did the following:


  1. 我安装了JDK 8版本(此步骤是可选的)。

  2. 我签出了分支 BETA_JAVA8 git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git
  3. $ b $我在Eclipse Juno SR1(Build ID:20120920-0800)的实例中导入了签出的项目。
  4. 我从我运行的Eclipse运行了一个新的Eclipse实例。 / li>
  1. I installed a build of JDK 8 (This step is optional).
  2. I checked out branch BETA_JAVA8 of git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git.
  3. I imported the checked out projects in an instance of Eclipse Juno SR1 (Build ID: 20120920-0800).
  4. I ran a new instance of Eclipse from my running Eclipse.

为了使用Java 8中提供的新语法,Eclipse表示我必须将我的代码的合规级别设置为1.8。要设置合规性级别,我必须将执行环境设置为 JavaSE-1.8 。此执行环境在 Windows - >中不可用偏好 - > Java - >已安装的JRE - >执行环境

To use the new syntax available in Java 8, Eclipse said that I have to set the compliance level of my code to 1.8. To set the compliance level, I have to set the execution environment to JavaSE-1.8. This execution environment was not available at Windows -> Preferences -> Java -> Installed JREs -> Execution Environments.

如何将执行环境设置为 JavaSE-1.8

How can I set the execution environment to JavaSE-1.8?

以下总结了一些安装执行环境的尝试:

The following summarizes some of my attempts to install the execution environment:


  1. 我遵循 wiki说明查找 JavaSE-1.8 在更新网站上 http://download.eclipse.org/eclipse/updates/ 4.2 。但是,执行环境的定义不在那里。

  2. 我在 JavaSE-1.8 =https://github.com/eclipse/rt.equinox.framework/tree/master/bundles/org.eclipse.osgi =noreferrer> git存储库rt.equinox.framework ,但是,不在那里。

  1. I followed the wiki instructions looking for a description of JavaSE-1.8 at the update site http://download.eclipse.org/eclipse/updates/4.2. But, the definition of the execution environment wasn't there.
  2. I looked for the JavaSE-1.8 profile in the git repository of rt.equinox.framework, but, it wasn't there.


推荐答案

想想你只需要改变'直接在'偏好文件'中: org.eclipse.jdt.core.prefs

Think you just have to change the 'settings' directly in the 'preference file' : org.eclipse.jdt.core.prefs .

eg org.eclipse.jdt.core.compiler.compliance = 1.8

这篇关于在Eclipse中编写Java 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆