如何更改Eclipse项目的JDK版本 [英] How to change JDK version for an Eclipse project

查看:560
本文介绍了如何更改Eclipse项目的JDK版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个仅与Java 1.5兼容的项目。我安装了Java 1.6。是否有某种形式的向后兼容性让Eclipse用1.5编译?



我必须安装Java 1.5才能在这里显示吗?或者还有另一种方式?



解决方案

点击添加库按钮。它带来您的屏幕指向Java位置。



选择目录,除JRE之外的按钮,并指向安装的文件夹位置。



即使您只需要1.5编译器项目,您可以通过更改Eclipse中的编译器设置来实现,而不是删除1.6 JRE并添加1.5 JRE。 / p>

  GOTO  - > JAVA  - 编译器--->并将编译器级别更改为1.5而不是1.6

由于davidfmatheson建议,



请小心,特别是如果您正在为一队人员设置这个工作。如果任何人在1.6中使用任何新功能或更改的内容,它将编译,但不会在JRE 1.5的环境中运行。


I need to write a project that's only compatible with Java 1.5. I have Java 1.6 installed. Is there some form of backwards compatibility to get Eclipse to compile with 1.5?

Do I have to install Java 1.5 to get it to show here? Or maybe there is another way?

.

解决方案

Click on the Add Library button. It brings your screen to point to the Java location.

Select "Directory", button right besides JRE home and point to the installed folder location.

Even though you want to just 1.5 compiler project, you can achieve it by changing compiler settings in Eclipse instead of removing 1.6 JRE and add 1.5 JRE.

GOTO -->JAVA--Compiler---> and change compiler level to `1.5` instead of `1.6`

As davidfmatheson suggested,

Just be careful, especially if you're setting this up for a team of people to work on. If anyone uses anything that is new or changed in 1.6, it will compile, but not run in an environment with JRE 1.5.

这篇关于如何更改Eclipse项目的JDK版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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