更新到新的 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. xilinx 网站资源导读

    [经验整理.01]Xilinx网站资源导读 ISE11版 标签:  ISE  Xilinx  入门  资源  2009-09-01 20:41 序 虽然自己也曾想过,但如果不是向农要求,把曾经写过的文 ...

  2. SharePoint2013 SharePoint-Hosted 模式 分页方法

    /**分页js插件 var ListPager = new listPaging(); 先调用start方法加载上下文 然后调用dataLoad方法查询第一页数据 需要设置几个属性值 ListPage ...

  3. NC表型参照类

    package nc.ui.bd.ref; /** * 表参照-其他参照基类. 创建日期:(2001-8-23 20:26:54) 模型里未处理栏目 * * @author:张扬 * */ impor ...

  4. java中的拷贝文件FileChannel

    以前用Java拷贝文件,只知道写byte数组循环拷贝,今天知道了可以用FileChannel进行拷贝,上代码: 下边是传统的byte数组拷贝方法 </pre><pre name=&q ...

  5. Java——String.split()函数

    在java doc里有 String[] java.lang.String.split(String regex) Splits this string around matches of the g ...

  6. android事件分发介绍

        Android事件分发 事件分发3个步骤 dispatchTouchEvent(event)派发 onInterceptTouchEvent(event)拦截 onTouchEvent(eve ...

  7. C++例题练习(2)

    环境:Dev-C++( Version:5.6.1) 1.循环输入一个1-1000的整数,判断是否为素数(输入1时程序结束) 素数:只能被1和自身整除. 实现代码: #include <iost ...

  8. 12天学好C语言——记录我的C语言学习之路(Day 8)

    12天学好C语言--记录我的C语言学习之路 Day 8: 从今天开始,我们获得了C语言中很有力的一个工具,那就是函数.函数的魅力不仅于此,一个程序到最后都是由众多函数组成的,我们一定要用好函数,用熟练 ...

  9. The method getContextPath() is undefined for the type ServletContext

    我出错时,到网上说得是版本问题,我找到对应的包javax-servlet5.1.12.jar,把它删了,居然不报错了,原来是和包servlet-2_5-api.jar冲突了

  10. Poj 2159 / OpenJudge 2159 Ancient Cipher

    1.链接地址: http://poj.org/problem?id=2159 http://bailian.openjudge.cn/practice/2159 2.题目: Ancient Ciphe ...