Skip to main content

Crate java_manager

Crate java_manager 

Source
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 spec::JavaSpec;

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
JavaInfo and JavaVersion — structured metadata from a Java installation. Core type representing a Java installation and its metadata.
local
Read the JAVA_HOME environment 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.
spec
Human-readable Java spec parsing and matching ("Eclipse Adoptium v^17.0.0 ax86_64"). Human-readable Java specification parsing and matching.

Functions§

best_match
Pick the best (highest version) match from a list of JavaInfo.
filter_by_version
Filter a list of JavaInfo by a version requirement.