可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I create a Maven project in Eclipse Helios. It works fine for a day, but then this warning shows up:
Build path specifies execution environment J2SE-1.4. There are no JREs installed in the workspace that are strictly compatible with this environment.
Since this message, the project stopped compiling and debugging. Does anyone have solution for this problem?
回答1:
In Eclipse from your project:
- Right-click on your project
- Click Properties
- Java build path: Libraries; Remove the "JRE System Library[J2SE 1.4]"
- Click Add Library -> JRE System Library
- Select the new "Execution Environment" or Workspace default JRE
回答2:
Whether you're using the maven eclipse plugin or m2eclipse, Eclipse's project configuration is derived from the POM, so you need to configure the maven compiler plugin for 1.6 (it defaults to 1.4).
Add the following to your project's pom.xml
, save, then go to your Eclipse project and select Properties > Maven > Update Project Configuration:
<project>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
回答3:
The above solutions fix the project or work around the problem in some way. Sometimes you just don't want to fix the project and and just hide the warning instead.
To do that, configure the contents of the warning panel and make sure to untoggle the "build path"->"JRE System Path Problem" category. The UI for this dialog is a bit complex/weird/usability challenged so you might have to fiddle with a few of the options to make it do what you want.
回答4:
In eclipse preferences, go to Java->Installed JREs->Execution Environment and set up a JRE Execution Environment for J2SE-1.4
回答5:
The actual cause of this warning is that you have configured your project to run with an earlier JRE version then you have installed. Generally this occurs whenever you use old projects with newer JREs.
This will likely cause no trouble at all. But if you want to be really on the save side, you should install the correct, old JDK. You can find them here: http://www.oracle.com/technetwork/java/archive-139210.html
If you then restart eclipse you can go into Window > Preferences > Java > Installed JREs > Execution Environments and set for in your case J2SE-1.4 the [perfect match] as eclipse calls it.
回答6:
If you have Java 1.8 then
You need this xml part in pom.xml and update project.
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
回答7:
the correct procedure to resolve this warning, as other people write, is to go inside your project Properties and click on Java Build Path located on the left. Now you will find inside the Libraries Window the J2SE 1.5, double click on this one and a new window will give you the possibility to choose the correct Excecution Environment. Now select your version and the warning will disappear.
回答8:
Did you setup your project to be compiled with 1.4 compliance? If so, do what krock said. Or to be more exact you need to select the J2SE-1.4 execution environment and check one of the installed JRE that you want to use in 1.4 compliance mode; most likely you'll have a 1.6 JRE installed, just check that one. Or install a 1.4 JRE if you have a setup kit, and use that one.
Otherwise go to your Eclipse preferences, Java -> Compiler and check if the compliance is set to 1.4. If it is change it back to 1.6. If it's not go to the project properties, and check if it has project specific settings. Go to Java Compiler, and uncheck that if you want to use the general eclipse preferences. Or set the project specific settings to 1.6, so that it's always 1.6 regardless of eclipse preferences.
回答9:
I was getting project warning as "Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment".
I removed the J2SE1.5 library and added new JRE System Library which resolved my problem
回答10:
Expand your project in work space>>Right click(JRE System Libraries)>>select properties>>selectworkspace default JRE
the above solution sol