Warning - Build path specifies execution environment J2SE-1.4

JavaEclipseMaven 2

Java Problem Overview


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?

Java Solutions


Solution 1 - Java

In Eclipse from your project:

  1. Right-click on your project
  2. Click Properties
  3. Java build path: Libraries; Remove the "JRE System Library[J2SE 1.4]"
  4. Click Add Library -> JRE System Library
  5. Select the new "Execution Environment" or Workspace default JRE

Solution 2 - Java

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>

Solution 3 - Java

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 just hide the warning instead.

To do that, configure the contents of the warning panel and make sure to toggle-off 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.

Solution 4 - Java

In eclipse preferences, go to Java->Installed JREs->Execution Environment and set up a JRE Execution Environment for J2SE-1.4

Solution 5 - Java

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.

Solution 6 - Java

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>

Solution 7 - Java

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.

Solution 8 - Java

I met the same warning in STS (Spring Tool Suite), if it may help someone somehow.

This is the source https://www.baeldung.com/eclipse-change-java-version, and here's a summary of it :

Warning : build path specifies execution environment javase-11. there are no jres installed in the workspace that are strictly compatible with this environment.

Environment : Ubuntu 20.04 (with default OpenJDK11) STS 4

To solve the warning :

  1. Change the JRE of the workspace of STS (By default, STS uses the JRE embedded in its plugins) : Window>Preferences>Installed JREs>Add>Standard VM>Directory (browse to your openjdk folder, in my case /usr/lib/jvm/java-11-openjdk-amd64)>Finish)
  2. Check the new JRE, then Apply and close
  3. Now configure the spring-boot project to use the newly added JRE : Right click on the project > properties > Java Build Path > in Libraries tab > Remove the old JRE, then in Modulepath Add Library > JRE System Library > Environments (choose JavaSE-11, make sure to check it on the right panel, mentionned "perfect-match"), Apply and Close

And voilĂ 

Solution 9 - Java

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.

Solution 10 - Java

Just change the version in Window-> Preferences-> Java -> Installed JREs. Check the installed JREs list. Then, Right-click on your project -> properties -> Java build path -> libraries. Change the "JRE System Library" to the version in "installed JREs".

The warning will be gone.

Solution 11 - Java

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

Solution 12 - Java

Expand your project in work space>>Right click(JRE System Libraries)>>select properties>>selectworkspace default JRE the above solution sol

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionnarseregView Question on Stackoverflow
Solution 1 - Javabtpka3View Answer on Stackoverflow
Solution 2 - JavaPascal ThiventView Answer on Stackoverflow
Solution 3 - JavaJilles van GurpView Answer on Stackoverflow
Solution 4 - JavakrockView Answer on Stackoverflow
Solution 5 - JavaChristianView Answer on Stackoverflow
Solution 6 - JavaN..View Answer on Stackoverflow
Solution 7 - JavacyberdemonView Answer on Stackoverflow
Solution 8 - JavaInasaView Answer on Stackoverflow
Solution 9 - JavaAndrei FierbinteanuView Answer on Stackoverflow
Solution 10 - JavaAnkitha JView Answer on Stackoverflow
Solution 11 - JavaPragati ChaturvediView Answer on Stackoverflow
Solution 12 - JavaAkhilView Answer on Stackoverflow