This project is a Java Virtual Machine (JVM) implemented in Rust, built to run Java programs independently of existing JVMs. Everything related to Java is implemented from scratch. The current version executes Java bytecode in interpreted mode, with the introduction of a Just-In-Time (JIT) compiler identified as a future milestone. The next major objectives include the integration of garbage collection and support for multithreading.
- 100% of actual opcodes (JVMS §6)
- Lambda Expressions (JLS §15.27)
- Static initialization (JVMS §5.5)
- Polymorphic models (JLS §8.4.8)
- Single- and multi-dimensional arrays (JLS §10)
- Exceptions (JLS §11)
- Record Classes (JVMS §8.10)
- Type casting (JLS §5.5)
- Program arguments (JLS §12.1.4)
- Assertions (JLS §14.10)
- Dynamic Language Support (partially)
- Stream API (partially)
- Reflection (some features)
- java.io (partially)
- java.nio (partially)
- java.util.zip (partially)
- java.lang.System (most features)
See integration tests for broader examples of supported Java features.
This project relies on standard library classes from the JDK 25 (LTS).
To run the Java code, you must have JDK 25 (LTS) installed on your machine and ensure the JAVA_HOME environment variable is properly set.
Ensure the following are set up:
- A machine running Windows, MacOS, or Linux
- Rust installed
- JDK 25 (LTS) installed with the
JAVA_HOMEenvironment variable set
Create a file named FruitCount.java with the following content:
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
public class FruitCount {
public static void main(String[] args) {
List<String> fruits = List.of("apple", "banana", "apple", "orange", "banana", "apple");
Map<String, Long> counts = fruits.stream()
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
System.out.println(counts);
}
}-
Compile the program using the Java compiler:
javac FruitCount.java
-
Run it using rusty-jvm:
cargo run -- FruitCount
rusty-jvm is licensed under the MIT License.