JMRI: Java 1.1.8 Compatibility
This page is now obsolete. Since JMRI 1.9.1, we no longer support Java 1.1.8. For more information, please see the JMRI Technological Roadmap.Macintosh computers running MacOS versions less than MacOS X (e.g. MacOS 8.6, MacOS 9) have only Java version 1.1.8 available. For a long time, we therefore keep the JMRI libraries as consistent as possible with that version of Java. This page talks about what that meant.
Achieving compatibility
"Some code is born compatible, some achieve compatibility, and some have compatibility thrust upon them"Things to consider:
- Use the Swing 1.1 member names
- Use the 1.1 collections. In particular:
import com.sun.java.util.collections.*;- Use
elementAt(int), notget(int)
- Some functions that are not available are handled in the jmri.util package. If you get a compile error due to a missing method while using the "check" target (see below), look in jmri.util for a class/method that will provide the same function for you.
- Note that named innner classes do not have unlimited access to the outer class members in Java 1.1. For example, if you have a class Inner declared within a class Outer, the methods and members of the Outer object will have to be referenced as Outer.this.foo in many cases.
Testing compatibility
The Ant configuration file "check.xml" contains several targets:- compile
- Does a special compilation targeting the special needs of the
1.1.8 JVM:
- Compile several files from the jmri.util package that must be compiled with Java 1.3 libraries.
- Use the "synchlist.csh" script to create an Ant file containing instructions to compile the files that need the "classic" compiler. These are compiled against the 1.1.8 library jar files.
- Compile the remaing source files with the default (modern) compiler, using the 1.1.8 library jar files.
- Complete the normal build process by copying properties files, etc.
- check
- The main target, this does clears the existing build, then recompiles the src and test directories as needed for JVM 1.1.8, and then runs alltest.