The following source and target is supported by javac 1.5.0
javac -source 1.2 -target 1.1 //min source min target
javac -source 1.2 -target 1.5 //min source max target
javac -source 1.3 -target 1.1 //max source with diffrent target
But 1.4 and 1.5 source requires 1.4 and 1.5 target.
> Student question: Are there any "interpreter" issues
> with compiling your java code with 1.3 and then
> running/executing the code with runtime 1.4?
Every generated class file contains a version stamp, and every version of Java specifies a range of supported versions.
Java 1.3 : 45.3-47.0
Java 1.4 : 45.3-48.0
The JVM will refuse to load a class if the class's version stamp is outside of the JVM's support range.
However, the JVM always support the entire version range from the previous version level, so you don't need to worry about the class not being loaded, for one.
Things get quickly complicated if you use java serialization and other frameworks or external libraries, XML parsers, application servers, etc....
So, in general, consider not mixing different java versions. In the wider J2EE world, you'll be asking for trouble.
And remember that it is possible to compile a class to a lower classfile version but getting problems at runtime if you use methods that exist only in the later version of that class in the standard library.
This is most relevant when overloaded versions were added in the later version you used for the compiler.