• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java 1.4 under Java 1.6?  RSS feed

 
Jochen Rittmann
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java does have good backward compatibility. Refer to this on the Sun Java website regarding compatibility.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!