No. Java tries to be backward compatible, so a 1.6 JVM should be able to run classes compiled by a Java 1.5 compiler. The reverse is not true.

srini carry

Ranch Hand

Posts: 83

posted 5 years ago

My project has a third party jar file which is complied by 1.6, my project I am creating a jar file this jar file I want to run on java 1.5 , please advice me how can I use the thirdparty jar built using 1.6 in my project which uses 1.5

I've been going through this a lot recently because I'm working on a project where I'm forced to use a Java 1.4 VM. (No, I'm not kidding. I wish I were.) I recently was able to find a relatively new vintage of Mockito that's separately maintained as JDK 1.4 compatible by a volunteer (bless him!) If you can't find something like that for your third party jar, and recompiling it from the source yourself (as Bill suggested) isn't working out, then you might have to try getting an earlier version of it and hope your project is not using the new features.

Another option is just upgrading your project to use Java 6. It's ridiculous to still be using Java 5, which is now years out of date. (Hello kettle, I'm pot. Pleased to meet you!)