Build path specifies execution environment J2SE

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?


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

  • 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>
    

    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.

    链接地址: http://www.djcxy.com/p/73830.html

    上一篇: 如何在Eclipse项目中指定旧的JDK合规性?

    下一篇: 构建路径指定执行环境J2SE