https://github.com/theseus-rs/ristretto
Java Virtual Machine
https://github.com/theseus-rs/ristretto
classfile java jvm
Last synced: 5 months ago
JSON representation
Java Virtual Machine
- Host: GitHub
- URL: https://github.com/theseus-rs/ristretto
- Owner: theseus-rs
- License: apache-2.0
- Created: 2024-07-08T23:04:04.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-25T01:46:51.000Z (5 months ago)
- Last Synced: 2026-01-25T08:27:38.834Z (5 months ago)
- Topics: classfile, java, jvm
- Language: Rust
- Homepage: https://theseus-rs.github.io/ristretto/ristretto_cli/
- Size: 7.05 MB
- Stars: 44
- Watchers: 0
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
- Security: SECURITY.md
Awesome Lists containing this project
README

# Ristretto
[](https://github.com/theseus-rs/ristretto/actions/workflows/ci.yml)
[](https://docs.rs/ristretto_classfile)
[](https://codecov.io/gh/theseus-rs/ristretto)
[](https://bencher.dev/perf/theseus-rs-ristretto)
[](https://crates.io/crates/ristretto_vm)
[](https://github.com/theseus-rs/ristretto#license)
[](https://semver.org/spec/v2.0.0.html)
Embeddable Java Virtual Machine [JVM](https://docs.oracle.com/javase/specs/jvms/se24/html/) implementation.
## Getting Started
`ristretto` java can be installed using the following methods:
### Linux / MacOS
```shell
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/theseus-rs/ristretto/releases/latest/download/ristretto_cli-installer.sh | sh
```
### Windows
```shell
irm https://github.com/theseus-rs/ristretto/releases/latest/download/ristretto_cli-installer.ps1 | iex
```
For more information, and additional installations instructions (cargo, homebrew, msi),
visit the [ristretto](https://theseus-rs.github.io/ristretto/ristretto_cli/) site.
### Features
- Runtime classes based on LTS versions of [AWS Corretto](https://github.com/corretto)
- Load classes from directories, jars, modules
- Url class loading from jars and modules
- Reading, writing, and verifying classes
- A low-pause, concurrent, parallel mark-and-sweep garbage collector
- Parallel Just-In-Time (JIT) compilation for x86-64, aarch64, s390x and riscv64
### Limitations
#### String Encoding
Ristretto uses Rust's `String` type to represent Java strings. This means that Ristretto does not support unpaired
surrogates from Java's UTF-16 encoding. Any unpaired surrogates will be replaced with the replacement character `�`
(U+FFFD) when decoding Java strings. For additional details on how Java and Rust handle strings, see
[encodings](docs/encoding/index.md).
#### Just-In-Time (JIT) Compilation
The JIT compiler only supports functions that use primitive type byte codes. The JIT compiler is not implemented for
functions that use object byte code or call other functions.
#### Threading
Threading is partially implemented. The JVM has been structured to implement threading using async with the `tokio`
runtime.
#### Runtime Native Methods
The Java runtime requires hundreds of native methods. This project aims to provide Rust equivalents for these methods
on an as needed basis. Currently, only a small subset of these are implemented. If a native method is called that is not
implemented, the program will panic. Please submit a pull request, or open an issue if you need a specific native
method implemented.
#### Java Native Interface (JNI)
JNI is not implemented.
#### Security Manager
Support for the Security Manager is not implemented and there are no plans to implement it. The security manager has
been deprecated; see: [JEP 411](https://openjdk.org/jeps/411)
`System.getSecurityManager()` will always return `null`, and `System.setSecurityManager()` will throw an exception.
#### Finalizers
Support for finalizers is not implemented and there are no plans to implement it. Finalizers have been deprecated; see:
[JEP 421](https://openjdk.java.net/jeps/421)
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
## 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.