Java
We currently run Java 17.
JDK Installation
Ubuntu
OpenJDK is the recommended JDK to install.
OpenJDK
Use apt to install Verify installation by opening a terminal and typingopenjdk-17-jdk
, openjdk-17-doc
, openjdk-17-source:
# apt install openjdk-17-jdk openjdk-17-doc openjdk-17-source
java -version
Windows
Download installer from https://www.oracle.com/java/technologies/downloads/#java17. The x64 MSI installer is the most convenient. Default installation settings are fine. Verify installation. Open a terminal and call Something like the following should be outputted: Aside: java will be installed at the locationOracle (recommended)
java -version
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)
C:\Program Files\Java
Configuration
Logging
See the IHMC Log Tools README for details on enabling different log levels.
Testing
For testing in IDE, see /wiki/spaces/HOWTO/pages/14288377. For testing with Gradle and on Bamboo, see IHMC CI Gradle plugin and /wiki/spaces/HOWTO/pages/14288249.
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