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

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

问题描述

我需要编写一个仅与 Java 1.5 兼容的项目.我安装了 Java 1.6.是否有某种形式的向后兼容性来让 Eclipse 与 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?

我是否必须安装 Java 1.5 才能在此处显示?或者也许有另一种方式?

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

.

推荐答案

单击添加库按钮.它带来了你的 screen 指向 Java 位置.

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

选择目录",JRE 主页旁边的按钮并指向安装的文件夹位置.

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

即使您只想使用 1.5 编译器项目,您也可以通过在 Eclipse 中更改编译器设置来实现它,而不是删除 1.6 JRE 并添加 1.5 JRE.

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`

正如 davidfmatheson 所建议的,

As davidfmatheson suggested,

请小心,尤其是当您要为一组人员进行设置时.如果有人使用 1.6 中新增或更改的任何内容,它将编译,但不能在具有 JRE 1.5 的环境中运行.

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天全站免登陆