Thursday, August 28, 2008

Eclipse plugin: Bad version number in .class file

I'm using eclipse (MyEclipse) and loaded the JavaCC plugin. The editor wouldn't open, complaining about a bad version number in .class file.

The problem was that the plugin had been compiled using java 1.6, and eclipse was running on a 1.5 jvm. I'm not sure of the best way to find what jvm version eclipse is running from.

I'm not quite sure how I could tell that, except I looked at the properties of the icon I used to start eclipse and the "target" was
"C:\Program Files\MyEclipse 6.5\eclipse\eclipse.exe" -vm "C:\Program Files\MyEclipse6.5\jre\bin\javaw.exe"

I tried
C:\Program Files\MyEclipse 6.5\jre\bin>java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)


So I needed to start up Eclipse with a different vm:
"C:\Program Files\MyEclipse 6.5\eclipse\eclipse.exe" -vm "C:\Program Files\Java\jdk1.6.0_05\bin\javaw.exe"

It all works fine now.

No comments: