更新到新的 Mac OS X 再打开Eclipse 编译程序会报错,

Exception in thread "main" java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0

原因是Eclipse 找不到新版本的Java Runtime 的路径,需要有人来告诉他,解决办法:

  1. Launch Eclipse.app
  2. Choose Eclipse -> Preferences
  3. Choose Java -> Installed JREs
  4. Click the Add... button
  5. Choose MacOS X VM as the JRE type. Press Next.
  6. In the "JRE Home:" field, type /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
  7. You should see the system libraries in the list titled "JRE system libraries:"
  8. Give the JRE a name. The recommended name is JDK 1.7. Click Finish.
  9. Check the checkbox next to the JRE entry you just created. This will cause Eclipse to use it as the default JRE for all new Java projects. Click OK.
  10. Now, create a new project. For this verification, from the menu, select File -> New -> Java Project.
  11. In the dialog that appears, enter a new name for your project. For this verification, type Test17Project
  12. In the JRE section of the dialog, select Use default JRE (currently JDK 1.7)
  13. Click Finish.

让Eclipse使用新版本的JRE的更多相关文章

  1. 浅谈Eclipse寻找JVM(JRE)的顺序机制(转)

    转自:http://blog.csdn.net/teedry/article/details/6666850 Eclipse也是一个普通的Java程序,因此必须有一个JRE做为运行环境.        ...

  2. Eclipse寻找JVM(JRE)的顺序机制

    http://developer.51cto.com/art/200907/135271.htm Eclipse也是一个普通的Java程序,因此必须有一个JRE做为运行环境.本文将简单谈谈Eclips ...

  3. eclipse配置tomcat 和JRE环境

    配置JRE环境,通俗点讲就是添加一个不同版本的jdk window——preferences——java——installed jres 点击add添加   选择standard VM 选择一个本机正 ...

  4. 让eclipse启动时拥有jre

    让eclipse 拥有jre,这样才能启动 eclipse/eclipse.ini 首行加入 -vm /home/liujl/installer/jdk/bin/java

  5. Java集成开发环境--Eclipse for J2EE配置JRE运行环境

    .d1 { border-style: none } .d2 { border-style: solid } .d3 { border-style: dotted } .d4 { border-sty ...

  6. Eclipse添加JDK,JRE切换

    Eclipse添加JDK Window---preferences 切换JDK,JRE

  7. ubuntu eclipse 找不到jre文件

    一. 把jdk下的jre文件copy到eclipse安装目录 二. 打开eclipse 重新设计library和工作空间

  8. Eclipse - Mac Os Default JRE missing

    转:http://stackoverflow.com/questions/1736993/eclipse-mac-os-default-jre-missing 1) Follow Joshua's a ...

  9. Eclipse添加默认的JRE

    打开eclipse,依次点击如下选项Window->Preferences-> Java -> Installed JREs.步骤见下图.   选中Installed JREs选项出 ...

随机推荐

  1. ASP连接11种数据库的常用语法

    1.Access数据库的DSN-less连接方法: 以下为引用的内容: set adocon=Server.Createobject("adodb.connection") ado ...

  2. 在webservice中传递Hashtable

    webservice中不支持hashtable的数据类型,那么如何在webservice中传递hashtable呢?我们可以通过将hashtable转化为webservice中支持的数组的类型来进行传 ...

  3. Android系统中的dp和px的转换

    android系统中DP和SP的转化:1.首先分析TypedValue.java 可以调用以下代码获得dp的值 TypedValue.applyDimension(TypedValue.COMPLEX ...

  4. sqlserver 理解数据集

    数据集分四类: 1.A∩B,既是所求数据集既在A中,又在B中 2.A∪B,既所求数据在数据集A中,或在数据集B中 3.A-B,既所求数据在数据集A中,不在数据集B中 4.B-A,既所求数据在数据集B中 ...

  5. kettle Add XML 、 XML Join

    1.将文件1.文件2组合成xml文件 文件1 f1;f2;f3 1;张三;24 2;李四;25 文件2 张三;语文;78 张三;数学;88 xml文件 <students> <stu ...

  6. java后台正则验证

    public static boolean checkPhone(String phone) { Pattern pattern = Pattern.compile("^[1][3-8]+\ ...

  7. 一个layer可以跟着画完的线移动ios程序 好玩啊。

    用法:采用的是关键帧实现的. 实验目的:让上层的layer子层能够跟着在另一个子层上花的线进行移动 .即当线画完之后,图形开始移动,并且能够停在最后的那个位置 效果图: 采用是直接在layer图层上进 ...

  8. 第28条:利用有限制通配符来提升API的灵活性

    参数化类型是不可变的.对两个不同类型T1和T2而言,List<T1>与List<T2>没有父子类型关系. 考虑: public class Stack<E> { p ...

  9. ssh连接失败解决方法

    执行如下命令: ssh-keygen -t dsa -P '' -f /etc/ssh/ssh_host_dsa_key ssh-keygen -t rsa -P '' -f /etc/ssh/ssh ...

  10. 探究为何rem在chrome浏览器上计算出错

    最近在一个项目中,测试同学提了一个bug,说手机上有个页面的某些字体显示偏大.就像这样 我用chrome浏览器在pc上测试了一下,发现pc上也有这个问题,但是用其它浏览器打开这个页面就没有发现这个问题 ...