Eclipse class version bug

2019-08-30 09:07发布

问题:

In eclipse 3.4 I'm trying to do some performance tests on a large product, one of the included libraries is the vecmath.jar (javax.vecmath package) from the Java3D project. Everything was working fine and then when trying to run it yesterday I get this exception/error not long after starting it up:

java.lang.UnsupportedClassVersionError: javax/vecmath/Point2f (Unsupported major.minor version 49.0)

Which I believe means that I'm trying to load a java 1.5 class file into a 1.4 jvm which is unsupported. However when I went to the class file to check this I saw this in the eclipse class file viewer:

Compiled from Point2f.java (version 1.2 : 46.0, super bit)

So the class loader says it is version 49.0 but the class file says its 46.0. I've tried cleaning and fully rebuilding the project, I've confirmed that the compiler version for the project is 1.4, the JRE is 1.4 and for the run configuration the 1.4 jvm is selected. I'm totally stuck on this, does anyone have any idea what might be causing this?

Thanks

===EDIT===

It turns out that a version of java3d which was incompatible with java 1.4.2 had been installed in C:\Program Files\java\j2re1.4.2_18\lib\ext. I installed a newer version of Java3D to play around with in java6 and i guess it installed the libs in all my JREs even the ones which were incompatible.

回答1:

Could there be another javax.vecmath.Point2f on your classpath?



回答2:

I believe JRE 1.5 is required for the latest version of Java3D.



回答3:

Have you checked:

Window
    -> Preferences
        -> Java
            -> Compiler
                -> Compiler Compliance Level

To see if this value is screwy?



回答4:

You have to add the

  1. "java_home : C:\Program Files\Java\jdk1.6.0_16"
  2. "path: C:\Program Files\Java\jdk1.6.0_16\bin;"

to your Environment Variables!