Crates.io | jimage-rs |
lib.rs | jimage-rs |
version | 0.0.3 |
created_at | 2025-06-21 16:42:13.457051+00 |
updated_at | 2025-09-03 19:59:09.057157+00 |
description | A fast and efficient Rust library for working with jimage files used by the Java Platform Module System. |
homepage | https://github.com/hextriclosan/rusty-jvm/tree/main/jimage-rs |
repository | https://github.com/hextriclosan/rusty-jvm |
max_upload_size | |
id | 1720948 |
size | 48,502 |
A fast and efficient Rust library for working with jimage
files used by the Java Platform Module System.
jimage-rs
is a Rust library and command-line utility for reading and extracting resources from Java image files (jimage
).
jimage
is a file format used by the Java Virtual Machine (JVM) to store class files and other resources in a compressed format. It is typically found in the lib/modules
directory of a Java installation.
The format was developed as part of Project Jigsaw (JEP-220) and is used in Java Platform Module System (JPMS).
This crate:
Sample code of extracting resources from a jimage file:
use std::env;
use std::path::PathBuf;
use jimage_rs::JImage;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let path = PathBuf::from(env::var("JAVA_HOME")?)
.join("lib")
.join("modules");
let jimage = JImage::open(path)?;
match jimage.find_resource("/java.base/java/lang/String.class")? {
Some(resource) => println!("Resource found: {:?}", resource),
None => println!("Resource not found"),
}
Ok(())
}
jimage-rs
command-line utility can be used to extract resources from a jimage file:
jimage-rs extract -r /java.base/java/lang/String.class $JAVA_HOME/lib/modules
This project is licensed under the MIT license.