We recommend using Java 17 with current JMRI versions starting with JMRI 5.9.1. Although Java 11 will work, we recommend that you install Java 17 as it's more up to date.
Starting with JMRI 5.0 through JMRI 5.8, the recommended Java version was Java 11. JMRI 5 will not work with Java versions below Java 11, and there are a small number of known issues with later versions.
JMRI needs a "Java Runtime Environment" (JRE) to run but will work fine with the larger "Java Development Kit" (JDK). A JDK is only needed if you want to work on JMRI development, i.e. make changes and compile them.
Before getting a new version of Java, it is useful to check what version is currently installed on your computer. On Windows, for example, open a "command" window by typing "Command prompt" into the search bar next to the Windows Start icon. Then type:
java -version
IT IS RECOMMENDED THAT YOU REMOVE OLD VERSIONS OF JAVA BEFORE YOU UPGRADE. This avoids a number of reported problems. On Windows, for example, you can:
See the JMRI Setup and Install pages for more information.
Linux distributions should use the standard package manager. For Debian based distributions such as Ubuntu, Mint, and Raspberry PI OS, the package manager is apt. For Red Hat based distributions such as Fedora and CentOS, the package manager is dnf.
The following steps use the terminal command line. The apt and dnf commands require root authority via sudo.
java -version
openjdk version "1.8.0_362" OpenJDK Runtime Environment (build 1.8.0_362-8u362-ga-0ubuntu1~22.04-b09) OpenJDK 64-Bit Server VM (build 25.362-b09, mixed mode)
The Java 1.8 version needs to be removed. That process is outside the scope of this document. Search for linux remove java. The steps involved depend on the distribution, the source and the Java version. An alternative is to use the local Java within JMRI approach. See Local Java
Command 'java' not found, but can be installed with: sudo apt install openjdk-17-jre-headless # version 17.0.6+10-0ubuntu1~22.04
bash: java: command not found... Install package 'java-17-openjdk-headless' to provide command 'java'? [N/y]Reply N, JMRI needs the full Java version.
sudo apt install openjdk-17-jre
Debian based
sudo dnf install java-17-openjdk
Red Hat based
Windows users should pick the ".msi" installer, as it properly sets up various registry values. Rebooting after installing is recommended.
macOS users might find the Adoptium installer (next item) easier to use than the Azul download.
On Windows: when you run the Java installer, be sure to select the "JavaSoft (Oracle) registry keys" option. Rebooting after installing is recommended.
On macOS: This will download a .pkg file. Double-click on it to run the installer.
On Windows: when you run the Java installer, be sure to select the "JavaSoft (Oracle) registry keys" option. Rebooting after installing is recommended.
We recommend that Windows users pick the "Windows x64 Installer", as it properly sets up various registry values.
Linux and macOS users can also install Java inside JMRI itself, instead of installing it centrally on their computer. This can be useful if you need different Java versions for other programs, or if for some reason you can't do the central Java install or removal.
We recommend installing Java as described on the top half of this page when possible. The local-install described here is only for cases when that can't be done. Note that you'll need to repeat this process every time you update JMRI, as the local Java install will be overwritten during the update process.
On macOS, the process is:
When you're done, the JMRI folder contents should look like the picture to the right.
You're all set to start JMRI using that local version of Java!
On Linux, the process is:
You're all set to start JMRI using that local version of Java!