问题
I wanted to create a JFrame (got all the Swing libraries needed) but this is what shows up on the design tab. I've been looking for similar problems but it only shows some other specific numbers , for example "Eclipse is running under 1.6" or "1.7" etc. But never have I seen "Eclipse running under 0" , what does this even mean? I uninstalled java and eclipse and re-installed them all over again...same problem. The execution works fine but I want to be able to edit the look of the frame on the design tab too.
回答1:
Try navigating to Window->Preferences->Java->Compilerand check your compliance level. Make sure it is set to 10.
回答2:
I just uninstalled JDK 10 and got the JDK 8u171 instead. And it's working just like it should have. You're just gonna have to change all of your project's JRE System Library to [jre1.8.0_171] and the compiler too and you're good to go. So far I only tried version 8 and it works, haven't tried other versions but my own thought is that the problem is with version 10, which means maybe version 9 works too but I didn't want to give it a go. (is there even a version 9 of JDK? I don't see any...)
来源:https://stackoverflow.com/questions/50193407/incompatible-java-versions-eclipse-running-under-0