i have a server - client application that runs on java 1.3; i want to change to java 1.6 step by step, meaning first few clients, than rest of the clients and finally server... i was wondering could you direct me to some common problems that can come along and what should i look after?
Sun tries to keep a high level of backward-compatibility, so you possibly simply can install the new JVM and restart your application with it.
A document describing the backward-incompatibilities from Java 1.6 with earlier version is here. This document links the compatibility-documents for Java 1.5 and Java 1.4 as well. You probably want to read this documents to learn about possible pitfalls.
Java 1.5 and Java 1.6 introduced new class-file-formats. The JVM's will run the old class-files as well, but recompiling your code - especially with JDK 1.6 - will help the new JVM to take advantage of some changes to make your application faster. So you might consider recompiling.
Additionally some new keywords were introduced, namely assert (in 1.4) and enum (in 1.5) (as Yuval already mentioned). If you use these words as identifiers, a recompile will fail, but the old class-files will work. You can provide the switch -source
to javac to let it compile: 'javac -source 1.3
' will compile the code without assert and enum as a keyword.
Off the top of my head, look for the names enum
and assert
in fields and local variables... These words have become keywords in java 1.4 and 5. The java 6 compiler will mark them as compilation errors if it sees them.
Yuval =8-)
Sun keeps a list of incompatibilities that are introduced with each new version of Java.
- Java SE 6 Release Notes: Compatibility
- Incompatibilities in J2SE 5.0 (since 1.4.2)
- Java 2 Platform, Standard Edition Version 1.4.2 Compatibility with Previous Releases
The last document for 1.4.2 has links to the compatibility notes back to JDK 1.0.
Generally, the backwards compatibility of Sun's JVMs is very good, but not perfect. I've seen three very large applications migrate from 1.3 to 1.5 and encounter only a small number of problems, the biggest of which was one Swing mask going into an endless event handling loop and freezing up the app under 1.4
The server part is unlikely to cause problems, but there have been pretty big under-the-hood changes in Swing, especially between 1.3 and 1.4 - the focus subsystem was completely rewritten, for example.
It's still possible that the app will run without problems, but you definitely should do extensive testing.
When I moved from 1.4.2 to 1.5 on a small applet I worked on, lots of things broke: screen refresh got all wonky, elements moved, etc.
Sun's JRE doesn't maintain backward compatibility for everything. Sometimes when items are deprecated, they completely go away after a very short period of time.
We wrote everything with "stock" Java, using Sun's libraries, too.
I've also seen several application written in pure Java that work fine on one or two platforms in the same version of the JRE fail on others with that version (the product I work with now works great on Windows, ok on Mac OS X, decent on Linux, but fails on Solaris - all with the same JRE).
Moving versions is not a simple step, unless the application is really small.
My experience is that the compatibility is quite high. I've only found one app ever that I couldn't get to run on a current version. For whatever reason (not having source, so I didn't dig into it) that one app wouldn't run on anything other than 1.4.2. Everything else I've ever dealt with (some of them quite sizeable) have come up to 1.6 just fine. No modifications required.
YMMV of course, so you'll have to try it and see...
© 2022 - 2024 — McMap. All rights reserved.