[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: Compiling for older version of java

joel a écrit :
I have set the Compiler Compliance level to 5.0 and verified the project now shows that the JRE System Library [JSE1-1.5] is loaded. However, when I attempt to run the jar file on an OSX box with JRE 1.5.0_07 I receive the following error:

'Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file'
Are you sure that your project settings are set to 1.5 for the compliance, source and target?

All my research reveals the obvious, the error indicates that I am attempting to run class files which were compiled on a a newer version of java on a system with an older version of java. This is the case as I have just explained, but I thought that setting the Compiler Compliance would cause the class files to be written to that version (as well as ensure I only use functionality in that version)?
If you take the default settings corresponding to compliance 1.5, then the source and target settings should indeed be set to 1.5.
But the compiler doesn't check that you are using functionnality only from 1.5. You need to set the libraries on your project to be 1.5.


You cal always open a bug report against JDT/Core and explain what are your settings.
--
Olivier