| Crates.io | ristretto_classloader |
| lib.rs | ristretto_classloader |
| version | 0.26.0 |
| created_at | 2024-08-09 05:02:04.100473+00 |
| updated_at | 2025-08-21 22:00:53.437574+00 |
| description | A library for loading Java classes. |
| homepage | |
| repository | https://github.com/theseus-rs/ristretto |
| max_upload_size | |
| id | 1330444 |
| size | 397,454 |
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:
$HOME/.ristretto/<version>%USERPROFILE%\.ristretto\<version>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(())
}
}
The following features are available:
| Name | Description | Default? |
|---|---|---|
url |
Enables url class path entries | No |
This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.
Licensed under either of
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.