A toy implementation of the Java Virtual Machine (JVM) 7 specification written in Zig. This JVM can execute Java bytecode including object creation, method calls, and field access. It implements core JVM concepts like the heap, call frames, and method dispatch.
I've written a blog post about it here.
Still work in progress, see here for a list of implemented features.
Requires Zig 0.15 if you are on Mac, you can run brew install zig and Docker is required.
docker run --rm -v $(pwd):/workspace -w /workspace openjdk:7 javac example/src/main/java/basic/*.java
zig build run -- example/src/main/java/basic FibonacciSee FEATURES.md for a comprehensive list of implemented and planned JVM features.
Compile the Java examples:
docker run --rm -v $(pwd):/workspace -w /workspace openjdk:7 javac example/src/main/java/basic/*.javaBuild and run the Zig VM with the following examples:
Fibonacci
zig build run -- example/src/main/java/basic FibonacciTest example
zig build run -- example/src/main/java/basic TestFor Loop
zig build run -- example/src/main/java/basic Loops