We currently run Java 17.
JDK Installation
Ubuntu
OpenJDK is the recommended JDK to install.
OpenJDK
Use apt to install openjdk-17-jdk
, openjdk-17-doc
, openjdk-17-source:
# apt install openjdk-17-jdk openjdk-17-doc openjdk-17-source
Verify installation by opening a terminal and typing
java -version
SDKMAN!
See the page on SDKMAN!
Now install Java:
sdk install java 17.0.3-zulu
Note, the JDK will be installed in a hidden folder located at (You may have to press Ctrl + H to view hidden folders in Ubuntu's file explorer):
~/.sdkman/candidates/java/17.0.3-zulu
Jetbrains Runtime
The Jetbrains runtime (customized JDK) is an option for installing on Linux. It provides font rendering fixes. Read more here.
Manual Azul Zulu JDK
Manually install Azul's Zulu JDK:
$ curl -sL https://cdn.azul.com/zulu/bin/zulu17.34.19-ca-jdk17.0.3-linux_x64.tar.gz -o zulu.tar.gz $ tar -xvzf zulu.tar.gz # mv zulu17.34.19-ca-jdk17.0.3-linux_x64/ /opt/. # rm /opt/zulu # ln -s /opt/zulu17.34.19-ca-jdk17.0.3-linux_x64/ /opt/zulu
Windows
Oracle (recommended)
Download installer from https://www.oracle.com/java/technologies/downloads/#java17. The x64 MSI installer is the most convenient. Default installation settings are fine.
(Aside: paths are already set by this installer. No action is needed)
Verify installation:
Open a terminal and call
java -version
Something like the following should be outputted:
java version "17.0.3.1" 2022-04-22 LTS Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6) Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)
Azul
We needed Azul JDK for Java 8 but there is no real need anymore. Any JDK distribution should work.
Azul is providing JDK 17 with JavaFX as part of their community Zulu distribution. You may also reference the official Zulu Installation Guide including the Installation on Windows Using the Zulu ZIP File page.
- Visit https://www.azul.com/downloads/zulu-community/?architecture=x86-64-bit&package=jdk-fx
- Under Zulu Community Downloads, select:
- Java Version: Java 17 (LTS)
- Operating System: Windows
- Java Package: JDK FX (if not already selected)
- Download the zip distribution and extract the contents to a temporary folder
- Move the extracted folder to something like
C:\Program Files\Zulu\zulu17.34.19-ca-fx-jdk17.0.3-win_x64
- In Windows > System Properties > Environment Variables
- Append the bin directory of the JDK to the PATH variable (i.e
PATH=<other_stuff>;C:\Program Files\Zulu\zulu17.34.19-ca-fx-jdk17.0.3-win_x64\bin
) - Under System Variables, set JAVA_HOME to the JDK directory (i.e
JAVA_HOME=;C:\Program Files\Zulu\zulu17.34.19-ca-fx-jdk17.0.3-win_x64
). Move it to the top of the list if you have multiple versions
- Append the bin directory of the JDK to the PATH variable (i.e
- Make sure you configure your IDE settings to reference this JDK. There will probably be 2 references - the Java compiler and the gradle compiler
- (Optional) Open a new console and check that java -version prints something like the following
java -version openjdk version "17.0.3" 2022-04-19 LTS OpenJDK Runtime Environment Zulu17.34+19-CA (build 17.0.3+7-LTS) OpenJDK 64-Bit Server VM Zulu17.34+19-CA (build 17.0.3+7-LTS, mixed mode, sharing)
Note: JDKs are also available from https://adoptopenjdk.net/, but they won't provide JavaFX, which breaks most of IHMC's robotics software.
Mac OS X
Download JDK and JavaFX from https://adoptopenjdk.net/ or https://www.azul.com/downloads/zulu/zulufx/
Download JavaFX 17 from https://www.azul.com/downloads/zulu-community/zulufx/
Needs help
This section needs more info. No one has tried this yet.
Configuration
Logging
See the IHMC Log Tools README for details on enabling different log levels.
Testing
For testing in IDE, see Unit Testing. For testing with Gradle and on Bamboo, see IHMC CI Gradle plugin and Integrating with Bamboo.
JVM options
Needs updating for Java 17.
Increase Stack Size
Use -Xss4m
for example to set a custom stack size. Default is 512 KB (-Xss512k
)
Increase Heap Size
To set maximum heap size use for example -Xmx512m
or -Xmx2g
.
To set initial heap size use for example -Xms512m
or -Xms1g
.
Non-standard options
Use java -X
to print out your specific version of Java's non-standard options. They are hard to find online because they are can be different for each JDK version. For example, here are the options for OpenJDK 1.8.0_232:
$ java -X -Xmixed mixed mode execution (default) -Xint interpreted mode execution only -Xbootclasspath:<directories and zip/jar files separated by :> set search path for bootstrap classes and resources -Xbootclasspath/a:<directories and zip/jar files separated by :> append to end of bootstrap class path -Xbootclasspath/p:<directories and zip/jar files separated by :> prepend in front of bootstrap class path -Xdiag show additional diagnostic messages -Xnoclassgc disable class garbage collection -Xincgc enable incremental garbage collection -Xloggc:<file> log GC status to a file with time stamps -Xbatch disable background compilation -Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size -Xss<size> set java thread stack size -Xprof output cpu profiling data -Xfuture enable strictest checks, anticipating future default -Xrs reduce use of OS signals by Java/VM (see documentation) -Xcheck:jni perform additional checks for JNI functions -Xshare:off do not attempt to use shared class data -Xshare:auto use shared class data if possible (default) -Xshare:on require using shared class data, otherwise fail. -XshowSettings show all settings and continue -XshowSettings:all show all settings and continue -XshowSettings:vm show all vm related settings and continue -XshowSettings:properties show all property settings and continue -XshowSettings:locale show all locale related settings and continue The -X options are non-standard and subject to change without notice.
-XX Options
For a list, see The most complete list of -XX options for Java JVM.
Realtime
The IHMC Realtime project contains documentation about IHMC's realtime Java configuration.
More pages:
Java Platform Module System
See Java Platform Module System
Learning Resources
- Guide: Learning Java
- The Java™ Tutorials
- Thinking in Java (ISBN 978-0131872486) by Bruce Eckel