Eclipse IDE - Error: Build path specifies execution environment Java SE 1.7

主宰稳场 提交于 2020-06-24 07:14:16

问题


In Eclipse, I am getting an error:

Build path specifies execution environment Java SE 1.7.
There are no JREs installed in the workspace that are strictly compatible with this environment.


回答1:


Try this

 In Eclipse,
your project
-> properties
-> java build path : Libraries
Remove the "JRE System Library[J2SE 1.4]"
-> click "Add Library" button -> JRE System Library
-> select the new "Executin Environment" or Workspace default JRE



回答2:


Go to Project|Properties Choose the Java Build Path section Select the current JRE System Library, and choose Remove Select Add Library, and under the JRE System Library category pick your system library; you probably just need to choose the Workspace default JRE

More generally, under Window|Preferences, you can check Java|Installed JREs|Execution Environments to know which of the installed JREs match a specific execution environment.




回答3:


This should work:

  • Your project > Build Path > Configure Build Path.
  • Go to Libraries tab.
  • Select JRE System Library [JavaSE-1.7].
  • Press Edit.
  • Notice that "Execution environment" is JavaSE-1.7 (jdk1.8.{y}).
  • Click on Installed JREs.
  • You should see jdk1.8.{y} but not jdk1.7.{x}.
  • Press Add.
  • Select Standard VM.
  • Press Next.
  • Locate your java folder, e.g.: C:\Program Files\Java\jdk1.7.{x}. If you don't have it, you need to install it.
  • Populate JRE home with it. e.g. C:\Program Files\Java\jdk1.7.0_80.

"Execution environment" will be JavaSE-1.7 (jdk1.7.0_80) now.




回答4:


Sounds like what I had after installing a newer Eclipse.

My solution:

Window->Preferences, Java->Installed JREs->Execution Environment.

Click the correct environment in the left panel, probably JavaSE-jre7

If the checkbox in the right panel is empty, check it.

If it's checked, but it isn't named jre7 [perfect match] then find the one in the left panel that does have 'perfect match' on the right and check that instead.




回答5:


I have this situation because I have multiple JDKs, and the JREs are nested below them. I'm building a JRE8 project but my current default is the latest v11. So the challenge is to get Eclipse to recognize the JDK>JREv8.

  1. Go to Preferences > Java > Installed JREs.
  2. Click Add.
  3. Navigate to the JRE under the JDK, which in my case is C:\Program Files\Java\jdk1.8.0_152\jre.
  4. Change the JRE name to JDK8 JRE8 just for clarity.
  5. Click Finish.

On build the error goes away. :)




回答6:


Go To Control Panel - check whether any new java version Updated -Uninstall it and Configure the Build Path JRE Library "Execution environment" to the Previous Version.

Probably if Java 7 is updated to Java 8 the above problem will occur. To avoid that warning, just you can uninstall the new update and restore the old version in execution environment.




回答7:


  1. Open eclipse
  2. Right click on your project -> click "properties"
  3. Select "Java Build Path" and then choose Librarires
  4. Delete JRE System Library [jre1.._***]
  5. Click "Add Library" and then choose "JRE System Library"
  6. The best solution is to mark "Workspace default JRE (jre1.,_***)
  7. Refresh project and wait for Tomcat or any other additional server to restart and then should be no error for "Execution environment.."Where to do it!



回答8:


Solved by

Right click on JRE System Library
Select Properties
Choose Workplace Default JRE
Apply and Close


来源:https://stackoverflow.com/questions/26345131/eclipse-ide-error-build-path-specifies-execution-environment-java-se-1-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!