Skip to main content

quick_search

Function quick_search 

Source
pub fn quick_search() -> Result<Vec<JavaInfo>, JavaError>
Expand description

Quickly searches for Java installations by looking for java in every directory listed in the PATH environment variable.

This function iterates over all paths in PATH, appends the platform‑specific executable name (java.exe on Windows, java elsewhere), and attempts to create a JavaInfo for each existing file. Entries that fail to produce a valid JavaInfo (e.g., because the release file is missing) are silently skipped.

§Returns

A Vec<JavaInfo> containing all valid Java installations found in PATH. The vector may be empty if none are found.

§Examples

use java_manager::quick_search;

let javas = quick_search()?;
for java in javas {
    println!("Found Java at {} (version {})", java.path.display(), java.version);
}