| Author |
Java 1.4 under Java 1.6?
|
Jochen Rittmann
Greenhorn
Joined: Jun 20, 2009
Posts: 6
|
|
Hello,
can i run an J2EE Application which is written under Java 1.4 in Java 1.6. Only compile 1.6 and then run?
Is there a official documentation about this theme?
Thank you,
Jochen
|
 |
Pushkar Choudhary
Rancher
Joined: May 21, 2006
Posts: 425
|
|
|
Java does have good backward compatibility. Refer to this on the Sun Java website regarding compatibility.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12950
|
|
Each version of the JDK comes with information about backward compatibility, Pushkar provided you already with a link for Java 6.
Backward compatibility has always been very important for Java. Normally you should not have any problems running old applications on a new version of Java. You do not even need to recompile the code - the old compiled classes should run fine. But you should test it first with your particular application - some programmers use unofficial APIs or other techniques that make their programs incompatible with newer versions of Java, it's impossible to guarantee 100% that everything will work.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
There are two reasons a program may break when upgrading your JVM:
1) programmers have used undocumented classes, like those in package that start with sun, sunw or com.sun. These classes can change or even disappear even between minor JVM updates.
2) there was a bug in the API at the earlier version, and the programmer has created a workaround. That workaround now causes bugs in the code since it is no longer needed.
The first one is much more frequent though.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
W. Joe Smith
Ranch Hand
Joined: Feb 10, 2009
Posts: 710
|
|
|
And, if I recall correctly, there were some new reserved words between 1.4 and 1.6, such as enum. I'm not sure how much of a problem that will cause, but I believe it has been discussed on here before.
|
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
Yes that is true however that is only a problem at compile-time:
Compile with 1.6: javac -source 1.4 Test.java --> Only a warning
Run with 1.6 java Test --> No error/exception
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
 |
|
|
subject: Java 1.4 under Java 1.6?
|
|
|