How to deal with 'Incompatible Java Versions r

2019-01-20 12:36发布

问题:

I have Eclipse installed with WindowsBuilder, and it has worked fine in the past in showing the design tab of JFrame.

I just installed Intellj, and installed a JDK in addition to my current SE-9 JVM. My eclipse program is still functional , but is showing the following when I open WindowsBuilder design:

Incompatible Java versions: Eclipse is running under 0, but this Java project has a 
9 Java compliance level, so WindowBuilder will not be able to load classes from this 
project. Use a lower level of Java for the project, or run Eclipse 
using a newer Java version

There must be something to the zero, rather than 1.8 or 9.

Other StackExchange answers suggest that I downgrade my Java version, but when I went to project/properties/java compiler, it did not work.

My java compiler is linked to SE-9, so I am unsure why this new error is occurring. Maybe it is due to installing the JDK as well?

回答1:

It's a known bug with the detection of Java version strings in Window Builder. Historically, the parsing of version strings was implemented to not check for the major version part at index position 0, e.g 9.0 or 10.0, but at index 2, namely 1.6, 1.7,...

Sadly, as of today, in the bug report 517291 we find this:

Patches welcome, we currently do not have active WB developers.

so somebody has to contribute a fix for this undesired behaviour that causes you pain.

So for now, you have to stay with Java versions less or equal to 1.8 if you want to use Window Builder in Eclipse. For reference, see this answer by greg-449 or this answer on this topic.

Hope this helps (for now).