Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing java version

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?

like image 977
tropikalista Avatar asked Nov 04 '08 12:11

tropikalista


3 Answers

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.

like image 70
Mnementh Avatar answered Sep 30 '22 05:09

Mnementh


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

like image 33
Yuval Avatar answered Sep 30 '22 07:09

Yuval


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.

like image 20
coobird Avatar answered Sep 30 '22 07:09

coobird