views:

1017

answers:

1

I was trying to compile a Grails application referencing third party JARs on Mac OSX. Although my system's JRE and JDK is set to Java 1.6 I always got a Compilation error: java.lang.UnsupportedClassVersionError: Bad version number in .class file when accessing classes in the JAR. Also when testing an existing Grails app the default stats of the app where showing that it's running with Java 1.6. So I really didn't have more ideas than to try to change the Java settings in Eclipse - I thought that's stupid as I'm not using Eclipse for the devlopment of this application - but voila - now the compilation of my app on the command line works just fine!

Can anyone explain me what Eclipse is doing here behind the scenes? I've had set the JAVA_HOME manually before with no effect.

+1  A: 
VonC
Thanks for you fast reply but I was not using Eclipse for that specific project before - Command Line and TextMate only! Here the compilation did not work because of an "Bad Version" error as I would run a Java 6 project with Java 5. But I didn't - everything looked like Java 6. But then I did the same what you have mentioned - I just changed the default JRE in Exclipse but did NOT import the project to eclipse and did NOT compile it using eclipse. I was still compiling from the command line with "grails compile" - and now the compilation suddendly succeeded without any errors. Sounds strange.
david