• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java 1.4 under Java 1.6?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java does have good backward compatibility. Refer to this on the Sun Java website regarding compatibility.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic