java_utils

java_utils contains some functions to help with Java

get_java_information(path: Union[str, PathLike]) JavaInformation

Returns Some Information about the given Java Installation

Parameters

path (Union[str, PathLike]) – The Path to the Installation. It must be the Directory. If your Java executbale is e.g. /usr/lib/jvm/java-19-openjdk-amd64/bin/java this Parameter must be /usr/lib/jvm/java-19-openjdk-amd64.

Returns

A dict with Information about the given java installation

Return type

JavaInformation

Raises a ValueError on the worng Path

Note

This Function executes the Java executable to detemine details such as the version. This might be a security risk.

find_system_java_versions(additional_directories: Optional[List[Union[str, PathLike]]] = None) List[str]

Try to find all Java Versions installed on the System. You can use this to e.g. let the User choose between different Java Versions in a Dropdown.

Parameters

additional_directories (Optional[List[Union[str, PathLike]]]) – A List of additional Directories to search for Java in custom locations

Returns

A List with all Directories of Java Installations

Return type

List[str]

macOS is not supported yet

find_system_java_versions_information(additional_directories: Optional[List[Union[str, PathLike]]] = None) List[JavaInformation]

Same as find_system_java_version(), but uses get_java_information() to get some Information about the Installation instead of just proving a Path.

Parameters

additional_directories (Optional[List[Union[str, PathLike]]]) – A List of additional Directories to search for Java in custom locations

Returns

A List with Information of Java Installations

Return type

List[JavaInformation]

macOS is not supported yet

Note

This Function executes the Java executable to detemine details such as the version. This might be a security risk.

View the source code of this module