Reprint: http://blog.csdn.net/wdjhzw/article/details/42086615
The protagonist of this article is this very confusing place, at least make me this beginner very tangled ...
Let's take a look at the official explanation (link)
Use
default JRE:
When
selected, the new Java project Wizard creates a New Java project which uses the workspace default JRE. The default JRE can be configured on the Java > Installed JREs preference page.
The project would also use the
default compiler compliance which can is configured on the Java > Compiler Preferen Ce page.
Click on
Configure default ... to Configure the default JRE and compiler compliance.
Use
project specific JRE:
When
selected, you can explicitly specify the JRE to be used for the new Java project. The new project would use a compiler compliance which matches the version of the selected JRE.
Use of an
execution Environment JRE:
When
selected, you can specify a execution environment to being used for the new Java project. The new project would use a compiler compliance which fits best the selected execution environment.
execution environments can be configured on the Java > Installed jres > Execution environmentspreference page.
In fact, the official interpretation of the objective should be explained clearly, but he explained at the same time, brought out the other unfamiliar concept, is this compiler compliance. Let's get this compiler compliance concept straight.
First, set his place here in Java > Compiler
As you can see, setting his parameter description is Compiler compliance level, literal translation is "compiler obey the rank". The following drop-down menu allows you to select the version of the JDK. In fact, this parameter is set to the level of your class , that is, which version of the JDK your program compiles, so the resulting class will run at least on this version of the JRE.
As an example:
For example, your JDK version is 1.7, and by default your compiler compliance level should be 1.7 because the JRE is already serviced by a program developed for the corresponding version of the JDK. The new JDK provides more functionality, all of which have a corresponding JRE (at least the corresponding JRE) to provide a running environment. So your JDK version is greater than or equal to compiler compliance level.
This parameter option is provided, taking into account the situation where the currently written program is running in a lower version of the JRE environment. At the same time, in order to be able to ensure that the lower version of the JRE can be run, you must always ensure that the high version of the JDK provided by the API, it is obvious.
Finally, you must install the corresponding lower version of the JRE to run this degraded compiled program, otherwise he prompts you to install the corresponding version of the JRE.
compiler compliance introduced, the following is said to build the project when the three JRE options specifically how to treat.
1. First, use the default JRE:
You will notice that I explained compiler compliance when the last picture, there is a configure ... Jump.
He's going to jump here. Java > Installed JREs
Here you can configure the JRE in your computer, as long as you want, from 1.1 to 1.7, of course now there are 1.8, all versions of the JRE you can install and add to here by adding button next to it. Note that this is the JRE, which has the JDK in name because the JRE is included with the JDK and is not installed separately. The JRE can be loaded as much as you like, but the JDK is enough.
Each JRE has a check box in front of it, although the check box, but only one is selected, and the selected will be the default JRE.
So, the use of the defaultJRE , when you set up the project, if selected, will be used as your built JRE. Just like the one I started with, and gave the hint "currently ' jdk1.7.0_71 '".
2. Then use the Use project specific JRE:
In fact, this option is complementary to the use default JRE . Previously said, you can install a number of versions of the JRE, select the Use default JRE will specify the default JRE for you to build the JRE, but if you want to select other installed JRE, you can select this using project Specific JRE, in the drop-down menu that follows, you can select the JRE you want to use.
Also,compiler compliance is set to the compilation level of the corresponding JRE version.
3. Finally, use an execution Environment JRE:
This option is the most tangled. You can see the scene after you click on the drop-down menu.
It provides all the running environment options that Eclipse supports (just options).
According to the official explanation, select this option and your compiler compliance will be set to correspond to the version of the JRE you have selected.
For example, I have only JRE1.7 on my computer, if I select the use of an execution Environment JRE and select "JavaSE-1.6", then there will be such a hint.
That is, the default compiler compliance compile level is 1.7, which is the JRE version of my JDK, and the new project will be specified as the compilation level of 1.6.
This seems to be the same as the custom compiler compliance I talked about earlier, and it seems to solve the warning problem that needs to correspond to the lower version of the JRE.
However, when you are finished building the project, you will see a warning in the problems view.
Well, yes, you still need to install the corresponding version of the JRE.
However, you write a "Hello world! "Can still be run. But the perfect Match option is to install a corresponding version of the JRE, here's perfect match, from here.
This is the compatible JRE that sets up that stack of JRE options. If you have multiple versions of the JRE installed, the compatible JRE on the left execution environment is listed in the Compatible JREs list on the right.
I have installed 1.7 and 1.8 versions of the JDK, and naturally have the corresponding version of the JRE, high version compatible with the lower version, so all the lists have these two options. But for JavaSE-1.7, the perfect match is of course the JRE that corresponds to its version. And his version, unless you also installed the corresponding JRE, otherwise cannot find the perfect match JRE.
Also, if you want to specify the default compatible JRE for a JRE in execution environment, tick the checkbox in front of the JRE on the right.
So, to summarize, that is:
1. If you have only one version of the JRE in your computer, because you are a beginner, beginner developer, or if your development requires only one version of the JRE, then you should choose the use default JRE: yes. Because your eclipse is started using this JRE, it will configure the JRE as the default JRE, which is usually the JRE in your JDK.
2. If you have multiple versions of the JRE in your computer, you can use the using project specific JRE: to select the JRE you want to use. This time because your JDK and JRE versions may not correspond, so compiler compliance will be tuned to the version of the JRE you have selected.
3. As for the use of an execution Environment JRE: This option, if the version of the JRE you want to choose is already installed, then you can choose with peace of mind. Or you must have escaped the warning.
In fact, use project specific JRE: and use an execution Environment JRE: Both options help you choose a different JRE, which lets you choose from the existing JRE, So you have what he gives you, more reliable, and the latter is to let you choose from the JRE he can provide, what he can provide, you can choose, but after the election you have no corresponding JRE that is another matter.
Finally, say a little more. I have installed the 1.7 and 1.8 versions of the JDK before, so there are two versions of the JRE. But the problem is that I used the eclipse to support the 1.7 version of the JRE, so even if I use the 1.8 JRE to create the project, his compiler compliance can be adjusted to the new features in 1.7,1.8. So 1.8 can only be unloaded, and so on later with the new eclipse to support 1.8 bar (online tutorial plug can support 1.8, do not want to toss the:-P).
Three JRE option differences for new Java projects in eclipse