24 releases (14 breaking)

Uses new Rust 2024

new 0.19.1 May 24, 2025
0.18.1 May 5, 2025
0.14.0 Mar 4, 2025
0.12.2 Dec 13, 2024
0.12.0 Nov 29, 2024

#57 in FFI

Download history 8/week @ 2025-02-01 4/week @ 2025-02-08 123/week @ 2025-02-15 45/week @ 2025-02-22 151/week @ 2025-03-01 16/week @ 2025-03-08 4/week @ 2025-03-15 2/week @ 2025-03-22 127/week @ 2025-03-29 295/week @ 2025-04-05 35/week @ 2025-04-12 6/week @ 2025-04-19 3/week @ 2025-04-26 249/week @ 2025-05-03 102/week @ 2025-05-10 163/week @ 2025-05-17

517 downloads per month
Used in 2 crates (via ristretto_vm)

Apache-2.0 OR MIT

1MB
23K SLoC

Ristretto ClassLoader

ci Documentation Code Coverage Benchmarks Latest version License Semantic Versioning

Getting Started

Implementation of a JVM Class Loader that is used to load Java classes. Classes can be loaded from the file system or from a URL; jar and modules are supported. A runtime Java class loader can be created from any version of AWS Corretto. The runtime class loader will download and install the requested version of Corretto and create a class loader that can be used to load Java classes.

The AWS Corretto runtime is installed in the following directory:

  • Unix: $HOME/.ristretto/<version>
  • Windows: %USERPROFILE%\.ristretto\<version>

Examples

use ristretto_classloader::{ClassLoader, ClassPath, Result};
use std::sync::Arc;

fn main() -> Result<()> {
    fn main() -> Result<()> {
        let (version, class_loader) = runtime::class_loader("21")?;
        let class_name = "java.util.HashMap";
        println!("Loading {class_name} from Java runtime {version}");
        let class = class_loader.load(class_name)?;
        println!("{class:?}");
        Ok(())
    }
}

Feature flags

The following features are available:

Name Description Default?
url Enables url class path entries No

Safety

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~10–24MB
~356K SLoC