简体   繁体   中英

Compiling to a specific JRE with Eclipse

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

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

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) I know the steps to compiling a project to a specific JRE:

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

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

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).

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 is What you have selected language level from the available one to set for your project.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM