For example, if we set the JAVA_TOOL_OPTIONS environment variable
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
then the first line is not the version:
$ java -version
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (Zulu 8.60.0.21-CA-macos-aarch64) (build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (Zulu 8.60.0.21-CA-macos-aarch64) (build 25.322-b06, mixed mode)
The getActualJavaVersion looks only at the first line (see here).
Ideally, it would skip over leading lines that start with Picked up. Related to nextflow-io/nextflow#1716