Expand description
This module provides functionality to detect available Java runtimes from given path(s).
It offers methods to recursively search through paths up to a certain depth to find Java runtimes.
§Examples
Here are some examples demonstrating how to use the functions provided by this module:
use java_runtimes::JavaRuntime;
use java_runtimes::detector;
use std::path::Path;
// Detect Java runtimes recursively within a path
let search_path = Path::new("/usr");
let max_depth = 2;
let runtimes = detector::detect_java(search_path, max_depth);
println!("Detected Java runtimes: {:?}", runtimes);
// Detect Java runtimes recursively within multiple paths
let paths = vec![
Path::new("/usr"),
Path::new("/opt"),
];
let runtimes = detector::detect_java_in_paths(paths.into_iter(), max_depth);
println!("Detected Java runtimes in multiple paths: {:?}", runtimes);
// Detect Java runtime from an executable path
let exe_path = Path::new("/usr/bin/java");
if let Some(runtime) = detector::detect_java_exe(exe_path) {
println!("Detected Java runtime: {:?}", runtime);
}
Functions§
- Detects available Java runtimes within the specified path up to a maximum depth.
- Attempts to detect a Java runtime from the given directory path.
- Attempts to detect a Java runtime from the given path.
- Attempts to detect a Java runtime from the given Java home directory path.
- Detects available Java runtimes from environment variables.
- Detects available Java runtimes within multiple paths up to a maximum depth.
- Detects available Java runtimes within the specified path and appends them to the given vector.
- Detects available Java runtimes within multiple paths up to a maximum depth and appends them to the given vector.