pub fn java_home() -> Option<JavaInfo>Expand description
Returns a JavaInfo for the Java installation pointed to by the JAVA_HOME
environment variable, if set and valid.
This function reads the JAVA_HOME variable, treats it as a path, and attempts
to create a JavaInfo from it. If the variable is not set or if the resulting
JavaInfo cannot be created (e.g., the path does not contain a valid Java),
None is returned.
ยงExamples
use java_manager::java_home;
if let Some(java) = java_home() {
println!("JAVA_HOME points to Java version {}", java.version);
} else {
println!("JAVA_HOME is not set or invalid");
}