pub fn get_java_architecture(java_path: &str) -> Result<String>Expand description
Determines the architecture (32-bit or 64-bit) of a Java installation.
This function runs various Java commands to determine the architecture. It tries multiple approaches:
- Attempts to run Java with
-d64flag - Attempts to run Java with
-d32flag - Parses system properties from
-XshowSettings:properties
§Arguments
java_path- Path to the Java executable
§Returns
Ok(String)containing “64-bit”, “32-bit”, or “Unknown”Err(JavaLocatorError)if the command fails or output cannot be parsed
§Examples
use java_manager;
fn main() -> java_manager::Result<()> {
let java_path = "/usr/bin/java";
let arch = java_manager::get_java_architecture(java_path)?;
println!("Java architecture: {}", arch);
Ok(())
}