Strange compile error

installed 1.5 last night butdidn’t do a thing to eclipse but when jme builds it stops with these errors the properties are all still set to 1.4.2_03 the errors still persist.



please help


compile:
       [javac] Compiling 397 source files to F:eclipseworkspacejmebuild
       [javac] F:eclipseworkspacejmesrccomjmesceneController.java:34: cannot access java.io.Serializable
       [javac] bad class file: C:Program FilesJavajre1.5.0_01librt.jar(java/io/Serializable.class)
       [javac] class file has wrong version 49.0, should be 48.0
       [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
       [javac] import java.io.Serializable;
       [javac]                ^
       [javac] 1 error
BUILD FAILED: F:eclipseworkspacejmebuild.xml:29: Compile failed; see the compiler error output for details.
Total time: 14 seconds

uninstalled 1.5 and it works again



would be interested to know what might have caused error though 1.5 will eventually have to go back in.

I believe the eclipse compile params you need to fool with there are target versions for source and compilation… I can’t remember off the top of my head.

I use Eclipse 3.1 and Java 1.5 at home and JME compiles fine. I’ll check tonight and let you know what the settings are.

OK, I just checked my setup. Eclipse 3.1.0 and java 1.5.0_02 are installed.



Under Window->Preferences->Java->Compiler I have Java Compliance Level set to 5.0.



Under Windows->Preferences->Java->Installed JREs I have the path to my 1.5.0_02 JRE install (Yes, its JRE, not SDK. Not sure why, but that is what it is).



My JME project uses the workspace settings outlined above. Everything compiles fine in both Eclipse and with the Ant Plug-in. The only problem I’ve seen is with JavaDocs under Windows (XP).



For the Ant ‘doc’ task, you need to have javadoc.exe in the path and I needed to add useexternalfile=“true” to the javadoc tag. Other then those two small changes, I have no problems building and using JME.

"mcbeth" wrote:

compile: ...
       [javac] bad class file: C:Program FilesJavajre1.5.0_01librt.jar(java/io/Serializable.class)
       [javac] class file has wrong version 49.0, should be 48.0


Looks like you are using Eclipse 3.0.something to use Java 5, but Java 5 is only supported by Eclipse 3.1. If you really want to use JDK1.5 with Eclipse, get the latest milestone (there is no eclipse 3.1 final yet), but be aware there are still troubles with the JDK1.5 debugger and some Java 5 features.

jME has no problems with Java 5 (I'm using it, too).

Edit: Be sure to start your eclipse in a Java 5 VM, too.

Class file has wrong version errors are generally due to using classes compiled in one JRE/JDK version in an earlier JRE/JDK.



So, you’re most likely compiling with the 1.4 JDK, but using the 1.5 runtime library (rt.jar). No idea how that happened to you…

"chaosdeathfish" wrote:
Class file has wrong version errors are generally due to using classes compiled in one JRE/JDK version in an earlier JRE/JDK.

So, you're most likely compiling with the 1.4 JDK, but using the 1.5 runtime library (rt.jar). No idea how that happened to you..

thats exactly what happened as I said I only install 1.5 didn't change anything in eclipse, when I check the properties all were set to 1.4.2_03 there was nothing to indicate any interference from 1.5. but when I switch jre to 1.5 the error persisted. the only thing I can gage is that 1.5 and 1.4 can't co-exist atleast for jme the other projects build fine. only difference is that jme uses build scripts

as for ecliopse its 3.1
"mcbeth" wrote:
only difference is that jme uses build scripts
Ah that'll explain it - the build script is still executed by java 1.4, isn't it? Configure eclipse to use Java 5 for the build script, too.
(I think there is no Problem with JDK1.4 and 1.5 coexisting and/or jME - works fine for me, too)
"irrisor" wrote:
Ah that'll explain it - the build script is still executed by java 1.4, isn't it? Configure eclipse to use Java 5 for the build script, too.
(I think there is no Problem with JDK1.4 and 1.5 coexisting and/or jME - works fine for me, too)


you misunderstand I installed 1.5 but did "not" change to it yet so 1.5 should have been effectively disabled as far as eclipse would have been concerned, like chaos said the compiler "still using 1.4.2_03 was somehow accessing 1.5's rt.jar which shouldn't be happening.

eclipse is useful but seems real finicky/picky/obstructive....... at times, but that could just be my inexperience talking
"mcbeth" wrote:
eclipse is useful but seems real finicky/picky/obstructive....... at times, but that could just be my inexperience talking
That's why I'm using IntelliJ IDEA most of the time :D

I still think did not misunderstand: Eclipse is most likely started with JDK1.5 as it uses the most recent version automatically (if everything is alright). That's why some JDK1.5 stuff might be in the classpath when executing the script though not having chosen 1.5 for the project...

ah, I see okay…something to consider then I’ll check when I install 2000 on my new pc it came with XP pro installed, but I dont trust it, as crazy as that sounds. I feel more in control when I use 2000 to work and leave xp for play…28yrs old and I still do tonnes of that :// :wink: :wink:

thanks fly



m