Crates.io | java-locator |
lib.rs | java-locator |
version | 0.1.8 |
source | src |
created_at | 2019-02-21 08:30:11.966929 |
updated_at | 2024-10-31 10:11:14.759223 |
description | Locates a Java installation in the host. |
homepage | |
repository | https://github.com/astonbitecode/java-locator |
max_upload_size | |
id | 116163 |
size | 31,475 |
This is a small utility written in Rust.
It locates the active Java installation in the host.
The utility can be used as a library, or as an executable:
extern crate java_locator;
fn main() -> java_locator::errors::Result<()> {
let java_home = java_locator::locate_java_home()?;
let dyn_lib_path = java_locator::locate_jvm_dyn_library()?;
let libjsig = java_locator::locate_file("libjsig.so")?;
println!("The java home is {}", java_home);
println!("The jvm dynamic library path is {}", dyn_lib_path);
println!("The file libjsig.so is located in {}", libjsig);
Ok(())
}
Having rust installed, you may install the utility using cargo:
cargo install java-locator --features build-binary
And then, issuing
java-locator
you should have an output like:
/usr/lib/jvm/java-11-openjdk-amd64
You may retrieve the location of the jvm
shared library:
java-locator --jvmlib
should give an output like:
/usr/lib/jvm/java-11-openjdk-amd64/lib/server
This may be used in cases when the LD_LIBRARY_PATH
(or PATH
in windows) should be populated.
You may also retrieve the location of any file inside the Java installation:
java-locator --file libjsig.so
and you can even use wildcards:
java-locator --file libjsig*
The latter two commands should return something like:
/usr/lib/jvm/java-11-openjdk-amd64/lib
At your option, under: