Documentation Union[pathlib.Path, str, None] = None) → Optional[universions.version.Version]

Get the Java versions.

Parameters:java_path – The path to the Java to check. If not defined, it uses JAVA_HOME from the enviroment variables to try $JAVA_HOME/bin/java. If JAVA_HOME is not defined either it tries only “java”.
Returns:The Java version.

Python example

>>> from import get_java_version
>>> get_java_version()
Version(major=11, minor=0, patch=2, prerelease=None, build=None)

CLI example

>>> universions java