1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! A library for locating Java installations on the local system and executing Java programs.
//!
//! This crate provides functionality to:
//! - Discover Java runtimes via `PATH`, `JAVA_HOME`, or deep system scans.
//! - Extract detailed metadata (version, vendor, architecture) from each installation.
//! - Execute Java applications with configurable arguments, memory settings, and I/O redirection.
//!
//! # Examples
//!
//! ```no_run
//! use java_manager::{java_home, JavaRunner};
//!
//! // Find all Java installations in PATH
//! let java = java_home().unwrap();
//! // Run a JAR file
//! JavaRunner::new()
//! .java(java)
//! .arg("--version")
//! .execute()?;
//! # Ok::<_, java_manager::JavaError>(())
//! ```
/// TTL-based cache that avoids redundant full-disk scans of Java installations.
/// Error types returned by every fallible operation in this crate.
/// Execute Java programs with configurable arguments, memory, and I/O.
/// [`JavaInfo`] and [`JavaVersion`] — structured metadata from a Java installation.
/// Read the `JAVA_HOME` environment variable.
/// Discover Java installations via `PATH`, Everything SDK, registry, BFS, and more.
/// Async JDK download with resume support, parallel chunks, and archive extraction.
pub use JavaCache;
pub use JavaError;
pub use JavaRedirect;
pub use JavaRunner;
pub use JavaInfo;
pub use JavaVersion;
pub use java_home;
pub use deep_search;
pub use full_search;
pub use quick_search;
pub use parallel_full_search;
/// Filter a list of `JavaInfo` by a version requirement.
///
/// See [`JavaInfo::matches_version`] for the supported requirement formats.
/// Pick the best (highest version) match from a list of `JavaInfo`.
///
/// Returns `None` if no installation matches the requirement.
///
/// # Examples
///
/// ```
/// use java_manager::{JavaInfo, best_match};
///
/// let javas = vec![
/// JavaInfo { version: "11.0.2".into(), parsed_version: java_manager::JavaVersion::parse("11.0.2"), ..Default::default() },
/// JavaInfo { version: "17.0.1".into(), parsed_version: java_manager::JavaVersion::parse("17.0.1"), ..Default::default() },
/// ];
///
/// let best = best_match(javas, "11").unwrap();
/// assert_eq!(best.version, "11.0.2");
/// ```