Expand description
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
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()?;Re-exports§
pub use cache::JavaCache;pub use error::JavaError;pub use execute::JavaRedirect;pub use execute::JavaRunner;pub use info::JavaInfo;pub use info::JavaVersion;pub use local::java_home;pub use search::deep_search;pub use search::full_search;pub use search::quick_search;
Modules§
- cache
- TTL-based cache that avoids redundant full-disk scans of Java installations. TTL-based cache for Java search results.
- error
- Error types returned by every fallible operation in this crate. Error types for Java environment detection and execution.
- execute
- Execute Java programs with configurable arguments, memory, and I/O. Running Java programs with controlled output and redirection.
- info
JavaInfoandJavaVersion— structured metadata from a Java installation. Core type representing a Java installation and its metadata.- local
- Read the
JAVA_HOMEenvironment variable. Functions for accessing Java from the local environment. - search
- Discover Java installations via
PATH, Everything SDK, registry, BFS, and more. System-level discovery of Java installations.
Functions§
- best_
match - Pick the best (highest version) match from a list of
JavaInfo. - filter_
by_ version - Filter a list of
JavaInfoby a version requirement.