简体   繁体   English

如何使用JRE 8设置eclipse?

[英]How to set eclipse with JRE 8?

I tried to update my jre version in eclipse, I added the jre 8 to my installed JRE's an checked him. 我试图在eclipse中更新我的jre版本,我将jre 8添加到我安装的JRE中并选中了他。 When I click OK it gives me an ERROR: 当我单击确定时,它给我一个错误:

The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from 
required .class files

It happens only when I am trying to use JRE 8. 它仅在我尝试使用JRE 8时发生。

Someone know how to fix this? 有人知道如何解决这个问题吗?

I use Indigo Eclipse. 我使用Indigo Eclipse。 Version: Service Release 2. 版本:Service Release 2。

The problem is rt.jar in the JVM 8.0. 问题是JVM 8.0中的rt.jar。

java.lang.CharSequence is a class under rt.jar. java.lang.CharSequence是rt.jar下的一个类。 rt.jar under JVM 7.0 has no problem, but rt.jar under JVM 8.0 has a problem with Eclipse Indigo. JVM 7.0下的rt.jar没问题,但JVM 8.0下的rt.jar的Eclipse Indigo有问题。 Solition is downloading Eclipse Kepler, JVM 8.0 with Kepler has no problem. Solition正在下载Eclipse Kepler,带有Kepler的JVM 8.0没问题。

Create new workspace. 创建新的工作区。 Create new java project and select jvm8 as jvm. 创建新的Java项目,然后选择jvm8作为jvm。 Changing the vm in an existing project is quite difficult and cached class file compiled with the previous vm can generate some strange unpredictable behavior 更改现有项目中的虚拟机非常困难,并且使用以前的虚拟机编译的缓存类文件可能会产生一些奇怪的不可预测的行为

You need Eclipse Kepler (4.3) Service Release 2. After startup you need to install a patch that enables using Java 8 in eclipse from this update site (Help -> install new Software... -> use site): 您需要Eclipse Kepler(4.3)Service Release2。启动后,需要从该更新站点安装一个修补程序,以启用在Eclipse中使用Java 8(帮助->安装新软件...->使用站点):

http://download.eclipse.org/eclipse/updates/4.3-P-builds/

But a Android Project will not benefit from Java 8 because it still uses Java 6 and you cannot use Lambda Expressions or even the diamond Operator from Java 7. 但是,Android项目不会从Java 8中受益,因为它仍然使用Java 6,并且您无法使用Lambda表达式,甚至无法使用Java 7中的菱形运算符。

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

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