Code Monkey home page Code Monkey logo

java-locator's Introduction

java-locator

crates.io

This is a small utility written in Rust.

It locates the active Java installation in the host.

Usage

The utility can be used as a library, or as an executable:

Library

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(())
}

Executable

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

License

At your option, under:

java-locator's People

Contributors

astonbitecode avatar amircodota avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.