Changing java version
Asked Answered
F

6

7

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?

Fleet answered 4/11, 2008 at 12:51 Comment(0)
O
11

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.

Otocyst answered 4/11, 2008 at 13:2 Comment(0)
T
4

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-)

Torin answered 4/11, 2008 at 12:55 Comment(0)
T
4

Sun keeps a list of incompatibilities that are introduced with each new version of Java.

The last document for 1.4.2 has links to the compatibility notes back to JDK 1.0.

Transfusion answered 4/11, 2008 at 13:48 Comment(0)
R
3

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.

Ribbonfish answered 18/5, 2009 at 11:18 Comment(0)
T
2

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.

Tonometer answered 4/11, 2008 at 13:20 Comment(3)
In my experience, screen refresh issues between versions generally originate from misuse of Swing APIs that were never guaranteed to work. There are definitely exceptions to that experience, though. :)Tepefy
I have never heard of a deprecate method actually being removed. Some deprecated methods from 1.0.x are still in Java 6. Can you give any examples?Deciliter
at this point, not off the top of my head - I haven't touched Java since 1.4.2, but there were definitely some issues with attempting to use 1.2-era calls in 1.4.2Tonometer
E
0

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...

Extenuatory answered 4/11, 2008 at 13:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.