6

So I got an error in eclipse saying "The compiler compliance specified is 1.8 but a JRE 15 is used", and when I try to change the Java compiler, eclipse said When selecting 1.8 compliance, make sure to have a compatible JRE installed and activated(currently 15). Configure the 'Installed JREs' and Execution Environments, or change the JRE on the Java Build Path

And when I go to the Java build path the JRE there is 1.8 instead of 15. And after that I went to Execution environments and saw JavaSE - 15 is the only one that has [perfect match] in the compatible JREs box, but if I try to add Java SE - 1.8, there is a new warning, something like Build path specifies execution environment JavaSE - 1.8, there are no JREs installed in the workspace that are strictly compatible with this environment

and after that, I have no idea what to do...

aliengamer90
  • 71
  • 1
  • 1
  • 2
  • So, did you add an actual Java 8 JDK onto your Installed JREs preference page? – nitind Mar 23 '21 at 01:09
  • Do you want to code in Java 8 or in Java 15? If in Java 8, do you have a Java 8 JDK installed on your system or do you want to use Java 15 via the `--release` option for that (this will generate Java 8 code, but all things that have been removed from the system library will be missing). – howlger Mar 23 '21 at 06:54
  • so I have JDK 8 installed, and I do not have JDK 15 installed. But in eclipse sets 15 as the default JRE, I don't know how to add JRE 8 to the library, and in the library right now is a JRE that I already deleted. And yes I want to use JRE 8 – aliengamer90 Mar 23 '21 at 15:41
  • so basically I just want to know how to add jdk to installed JREs preference page. thanks! – aliengamer90 Mar 23 '21 at 15:49
  • Use this answer to set your preferred jre https://stackoverflow.com/a/58353576/11775515 – Prashant Joshi May 19 '21 at 09:14

1 Answers1

10

In the preferences do you see something like this - Windows->Preferences->Java->Installed JREs

enter image description here

Either ensure the proper JRE is there or go to the Windows->Preferences->Java->Compiler and make sure your compliance setting matches.

WJS
  • 36,363
  • 4
  • 24
  • 39
  • um how do you add JDK to installed JRE? what folder should I put them in? jre(default) is the only one in my installed JREs, I tried to put jre 8's folder to where eclipse stored that default jre, but it didn't work. – aliengamer90 Mar 23 '21 at 15:46
  • @aliengamer90 SO just messaged me about this answer, so I checked it out. So I was wondering if my edited answer ever solved your problem? – WJS Jun 14 '23 at 19:21