JMRI: Java Version-Specific Features
Author: Bob Jacobsen
Keywords: JMRI technical code road map

# JMRI: Java Version-Specific Features (Older Page)

This is the "historical page" for the Java Version-Specific Features page.

## Capabilities

This section lists new Java capabilities, and which Java version they first appeared in. The "JDK" column shows the first Java Development Kit that could compile the feature; the "JRE" column lists the first runtime environment that could run the feature, including the needed JVM and library support.

Feature | JDK | JRE
--- | --- | ---
HiDPI graphics support for Windows and Linux users. Probably "just works" with JRE update, unless something in JMRI breaks on Java 9 on Windows (Currently support using very large fonts as a workaround, but it quickly breaks as text overlaps widget boundaries) | 1.8? | 1.9
It seems that MacOS X (macOS) users will lose the use of the OS X App menu for About, Preferences, and (critically) Quit handling on that platform | 1.9 | 1.9
It seems that MacOS X (macOS) users will lose Applescript scripting | 1.9 | 1.9
Generics for Swing classes | 1.7 | 1.7
NIO improves .zip file access | 1.7 | 1.7
I18N I/O improvements | 1.7 | 1.7
Memory use and GC improvements (better performance) | 1.7 | 1.7
Jetty Version 9 | 1.7 | 1.7
JUnit 4 and the `assert` keyword | 1.7 | 1.7
Desktop class | 1.6 | 1.6
JDOM2 (generics) | 1.6 | 1.6
Toolbars | 1.6 | 1.6
JTable Sorting | 1.6 | 1.6
Webstart compatibility | 1.6 | 1.6
SwingWorker | 1.5 | 1.5 (*1.4)
JSpinner | 1.5 | 1.5
Enums | 1.5 | 1.5
printf, Formatter | 1.5 | 1.5
generics | 1.5 | 1.5
Annotations | 1.5 | 1.3
JavaMail | 1.5 | 1.3
JUnit 4.0 | 1.5 | 1.3
JDOM 1.0 | 1.4 | 1.3
Java regexp | 1.4 | 1.4
Java3D | 1.4 | 1.4
JavaHelp update | 1.4 | 1.4
Drag and Drop | 1.4 (additional improvements in 1.6) | 1.4, 1.6
Logging API | 1.4 (additional improvements in 1.6) | 1.4, 1.6
XML catalog resolver | 1.3? | 1.4?
Collections | 1.3 | 1.3
Java2D | 1.3 | 1.3
Printing update | 1.3 | 1.3
JUnit 3.8 | 1.3 | 1.3

(* indicates that a compatibility library is used in the early version)

## JRE availability

This section lists the most recent Java Runtime version available for various operating system versions. Please note that not all users of that operating system will have updated to this Java version; many will be using an older one.

Oracle's page on Java 1.7 requirements which says "Note: As of April 8, 2014 Microsoft stopped supporting Windows XP and therefore it is no longer a supported platform." Google finds numerous pages that show how to install Java 1.7 on XP or XP SP2.

OS and platform | Last JRE
--- | ---
Linux | (depends?)
Win 8 (32-bit) | 1.8
Win 7 (32-bit) | 1.8
Win Vista (32-bit) | 1.8
Win Server 2008 (32-bit) | 1.8
Win Web Server 2008 (32-bit) | 1.6
Win 2000 (32-bit) | 1.6
Win Server 2003 (32-bit) | 1.6
Win 8 (64-bit) | 1.8
Win Server 2012 (64-bit) | 1.8
Win Server 2012 R2 (64-bit) | 1.8
Win 7 (64-bit) | 1.8
Win Server 2008 R2 (64-bit) | 1.8
Win Server 2008 (64-bit) | 1.7
Win Web Server 2008 R2 (64-bit) | 1.6
Win Vista (64-bit) | 1.8
Win 2003 (64-bit) | 1.6
Windows XP | 1.8 Unofficial Support
Windows 98 (2nd Ed) | 1.5-11
Windows 98 | 1.4.2_14
Windows 95 | 1.3.1_20
Mac OS X 10.8.3 and later on Intel | 1.8
Mac OS X 10.7.3 and later on Intel | 1.7
Mac OS X 10.5.8 and later on Intel | 1.6 (Apple JVM)
Mac OS X 10.5.7 and earlier on Intel | 1.5 (Apple JVM)
Mac OS X 10.3 and later on PowerPC | 1.5 (Apple JVM)
MacOS "Classic" | 1.1.8
OS/2 | 1.3

See the Java.com download page for all Operating Systems and
information on Java versions and hardware requirements.

## System Requirements

The following combination of JMRI - Java - Platform/OS versions was based on Oracle and OS developers sources. It's translated to the OS install instructions (follow hyperlink in OS headers):

JMRI | Java | OS X | Windows | Linux | Ubuntu | Raspbian
--- | --- | --- | --- | --- | --- | ---
4.2 | 1.8 | 10.8.3+ Mountain Lion | Win7 SP1/8/10, Vista SP2, (XP) | 5.5+ | 12.04+ | 14.04LTS
3.10.1 | 1.7 | 10.7.3 Lion | Win7 SP1/8/10, Vista SP2, (XP) | 5.5+ | 12.04 | 12.04
3.10.1 | 1.6 | 10.6 Snow Leopard (JVM6) | Win2003, Win2000 (x86) | 5.5 | 10.4 | N/A
2.14.1 | 1.5 | 10.5.7 Leopard (JVM5) | Vista SP1, Win2000 SP3, Win8.x (x64) |  | 9.04 | N/A
2.8 | 1.5 | 10.4 Tiger | Win98 (2nd Ed), XP, ME |  |  | N/A
2.2 | 1.5 | 10.3 Panther | Win98, ME | N/A | N/A | N/A
| 1.3.1 | 10.3 Panther | Win95, Win98 | N/A | N/A | N/A
1.6 | 1.1.8 | MacOS9.1 (MRJ) | Win95, Win98 | N/A | N/A | N/A

## Moving to Java 1.8 from 1.6

This section discusses, roughly in order of decreasing importance, the process of migrating from Java 1.6 to Java 1.8.

### Generics, Swing and JComboBox

Java 1.8 introduces generics for Swing objects. The most common one is JComboBox. This Java 1.6 line:

        JComboBox box = new JComboBox();

describes the creation of a JComboBox that selects generic (Object) items.
In Java 1.8, the JComboBox holds and selects objects of a specific type, usually String. It's written:

        JComboBox<String> box = new JComboBox<>();

The most common code for getting the selected item still includes a cast:

        String result = (String)box.getSelectedItem();

because the JComboBox can actually contain objects of other types (How can this happen? If the box is editable, and somebody enters some other type).
To avoid the case, a more robust idiom is:

        String result = box.getItemAt(progBox.getSelectedIndex());

### Javadoc and doclint

Java 1.8 by default runs the doclint doclet when making Javadoc. By default, it is very aggressive on possible errors. The default Ant-based builds turn off some of the checking terms with

    -Xdoclint:all,-missing,-accessibility,-html,-syntax

to drop tests for missing Javadoc tags and certain benign HTML errors. (For now)

## JVM and JDK Extensions

It's possible to extend the JVM and/or JDK installed on your machine via the endorsed-standards override mechanism and the extension mechanism. Those extensions, if present, take precedence over code shipped with applications like JMRI. Unfortunately, these can cause problems if the installed extensions interfere with a JMRI component. For example, an older (or younger) version might not be compatible, etc. It is very unusual for this to cause a problem with JMRI. You should investigate other possible causes before looking into this one! To check for this, execute the following from the command line: `java -XX:+CheckEndorsedAndExtDirs` If you get a message about a specific directory, look there for conflicting Jar files. You should probably consult the JMRIusers or jmri-developers mailing list for help before changing that directory!