This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Java SE 1.4 to Java 5 Migration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java SE 1.4 to Java 5 Migration" Watch "Java SE 1.4 to Java 5 Migration" New topic
Author

Java SE 1.4 to Java 5 Migration

Roshini Sridharan
Ranch Hand

Joined: Jan 16, 2001
Posts: 143
Hi,

I work on migrating an Application that works with JRE1.4. As part of the migration, When i run the existing Application code without compiling to JDK 5, it works fine Java 5.

When I tried compiling my application using JDK 5, there's no error reported. But when I run the application find that it throws AbstractMethodError using JRE 5.

My application refers to proprietory Framework Jar files that's not recompiled for JRE 5, is that causing the AbstractMethodError issue ..?

Also would like to know in case of migration where we have reference to some proprietory/open source Jar files, is it required that we get the migrated/recompiled version of those files.. so that the application compiled on JDK 5 works seamlessly with the reference Jars.

Would appreciate if there are some insights on the migration process and correct the understanding.

Thank you.

Regards
Roshini S
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Why are you migrating to an unsupported platform that's been obsolete for years? Java 6 should be your new platform.

And no, dependent libraries do not need to be recompiled, just like your Java code does not need to be recompiled. This particular issue should be very rare; in all likelihood, the dependent library will have a newer version available that addresses the issue. If not then it's quite old and unsupported, and you should move away from it.

If I were to go out on a limb I'd say that your dependent library is possibly a JDBC driver (or tool).
Roshini Sridharan
Ranch Hand

Joined: Jan 16, 2001
Posts: 143
Will be migrating to Java 6 or Java 7. This is just a test run kind.

Thank you Tim for your input.

Regards
Roshini S
Freidrick Essamburger
Greenhorn

Joined: Jun 02, 2012
Posts: 4
I think all JDK versions have backward compatibility. So if you are using JDK5 on code that was made in JDK4 it should compile fine. Don't understand your question completely. But there is a difference between JDK and JRE. If you think JDK to be your car then JRE is your engine.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Tim Moores wrote:If I were to go out on a limb I'd say that your dependent library is possibly a JDBC driver (or tool).

Since I got curious I searched a bit, and it turns out I misremembered: the JDBC problem about AbstractMethodError occurs between Java 5 and Java 6: http://stackoverflow.com/questions/1238252/how-to-make-jdbc-driver-work-in-java-5-6
Roshini Sridharan
Ranch Hand

Joined: Jan 16, 2001
Posts: 143
I also would like to know, without compiling the Application for the JRE 5 or 6 does the application bring in Performance enhancement provided as part of the Java higher version [5/6/7] unless we use the language features ?

Thank you
Roshini S
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Yes. Those improvements are predominantly in the JVM (and, to a lesser degree, in the class libraries), not in the compiler or in the new syntax.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38463
    
  23
There are a few changes which might cause problems, eg use of the word enum as an identifier, different method calls when overloaded methods might be called with boxed primitives as arguments. But I think (definitely not certain) that you would only have such problems if you recompile the code.
You might get all sorts of compiler warnings about missing generics, but if the code worked on Java1.4 without generics, I can’t see that you will have any new problems.
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
Does the stack trace of the error tell you which method it is trying to call when it fails ?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Sun and Oracle have always been very careful to make sure newer versions of Java are backward compatible with older versions. You should be able to run your old Java programs unmodified on newer versions (recompiling is not necessary). However, there can be minor incompatibilities. Each new version of the JDK comes with documentation about possible incompatibilities with previous versions:

Incompatibilities in J2SE 5.0 (since 1.4.2)
Java SE 6 Compatibility
Java SE 7 and JDK 7 Compatibility

Also, it is possible to write programs in Java that are not compatible with newer versions. For example, if you use undocumented APIs then your program might not work on a newer version.

Tim Moores wrote:Why are you migrating to an unsupported platform that's been obsolete for years? Java 6 should be your new platform.

No, Java 7 should be your new platform, because Java 6 is going to be end-of-life sooner than you think (this year!).

Can you tell us some more details about your AbstractMethodError, so that we can help you find out what the exact cause is?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java SE 1.4 to Java 5 Migration