Are there problems if you compile java 1.3, but use runtime java 1.4?

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? Will the results be consistent as if you compiled and ran with the same java version? Is there anything I need to worry about?
[279 byte] By [studentMea] at [2007-10-3 10:23:16]
# 1
you could run all the features of jdk1.3 in jdk1.4, absolutely there is no problem but vice versa not possible!.
narayanab16a at 2007-7-15 5:44:59 > top of Java-index,Java Essentials,Java Programming...
# 2
> you could run all the features of jdk1.3 in jdk1.4,> absolutely there is no problem but vice versa not> possible!.Depricated versions also to be considered.
harishotya at 2007-7-15 5:44:59 > top of Java-index,Java Essentials,Java Programming...
# 3

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.

AmitavaDeya at 2007-7-15 5:44:59 > top of Java-index,Java Essentials,Java Programming...
# 4

> 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.

karma-9a at 2007-7-15 5:44:59 > top of Java-index,Java Essentials,Java Programming...
# 5

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.

jwentinga at 2007-7-15 5:44:59 > top of Java-index,Java Essentials,Java Programming...
# 6
Read this:[url= http://java.sun.com/j2se/1.4.2/compatibility.html]Java 2 Platform, Standard Edition Version 1.4.2 - Compatibility with Previous Releases[/url]It contains all the details you need to know about binary and source compatibility.
jesperdja at 2007-7-15 5:44:59 > top of Java-index,Java Essentials,Java Programming...