使用 Eclipse 编译为特定的 JRE [英] Compiling to a specific JRE with Eclipse

查看:20
本文介绍了使用 Eclipse 编译为特定的 JRE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个关于将 Eclipse 中的项目编译为特定 JRE 的问题:

I have two questions regarding compiling a project in Eclipse to a specific JRE:

1) 项目的属性窗口 > Java 构建路径 > 库选项卡:

1) Properties window for project > Java Build Path > Libraries tab:

如果我想编译为 JRE 6 - 窗口是否应该显示 JRE 6 和 JRE 7 包含在构建路径中?还是只有JRE 6就足够了?

If I want to compile to JRE 6 - Should the window show JRE 6 and also JRE 7 as included in the build path? Or is only JRE 6 sufficient?

我目前的情况 - 好还是坏?

My current situation - good or bad?

2) 我知道将项目编译为特定 JRE 的步骤:

2) I know the steps to compiling a project to a specific JRE:

a- 确保 JRE 在 Eclipse 中已安装的 JRE 列表中.

a- Make sure the JRE is in the installed JREs list in Eclipse.

b- 在我显示的窗口中单击添加库",将其添加到项目的构建路径中.

b- Add it to the Build Path of the project, by clicking 'Add Library' in the window I showed.

c- 将项目的编译器合规性级别设置为与我希望我的应用程序能够在其上运行的最旧的 JRE(我添加到构建路径的 JRE)相同.

c- Setting the Compiler Compliance Level of the project to be the same as the oldest JRE I want my application to be able to run on (the JRE I added to the build path).

这都很好,但我还是不明白一件事:Java Build Path 中的 JRE 和设置为 Compiler Compliance Level 的 JRE 版本有什么区别?

This is all good, but I still don't understand one thing: What's the difference is between the JREs in the Java Build Path, and the JRE version set as the Compiler Compliance Level?

推荐答案

Compiler Compliance Level 是您从可用的语言级别中为项目设置的语言级别.

Compiler Compliance Level is What you have selected language level from the available one to set for your project.

虽然 Build Path 用于创建 Java 类路径.

While The Build Path is a used to create Java classpath.

在构建类路径中,它是构建项目时编译器可见或可用的路径集合.

In The build classpath it is a collection of paths visible or availabel to the compiler when building the project.

配置构建路径"对话框用于操作项目中名为 .classpath 的文件.该文件通常是隐藏的.

The Configure Build Path dialog is used to manipulate a file in your project called .classpath.Which is normally hidden.

那么您为项目选择的合规级别将用于该特定合规级别的执行.

So what the Compliance level you have selected your project will go for that particular compliance level execution.

这篇关于使用 Eclipse 编译为特定的 JRE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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