A Java 1.8 compatible JVM implementation written in Rust, featuring comprehensive test automation and modern development practices.
- Java 1.8 Compatibility: Full support for Java 1.8 bytecode and language features
- Comprehensive Testing: Automated test suite with multiple test scenarios
- Modern Architecture: Clean, modular Rust implementation
- Easy Testing: One-command test execution with intelligent compilation
- Cross-platform: Works on macOS, Linux, and Windows
- Language: Rust (90%+ code generated with Cursor)
- Target: Java 1.8 JVM Specification
- Build System: Cargo
- Testing: Custom test automation scripts
- Rust (1.70 or higher)
- Java JDK 8 (for compilation and rt.jar)
# Clone the repository
git clone https://github.com/yourusername/rust-jvm.git
cd rust-jvm
# Build the project
cargo build --release# List all available test cases
./run_tests.sh -l
# Run a specific test (auto-compiles if needed)
./run_tests.sh -f TestProgram
# Force recompile and run
./run_tests.sh -f TestProgram -c
# Interactive test selection
./run_tests.sh- TestProgram: Comprehensive JVM feature testing
- SimpleStaticTest: Static field and method testing
- SimplePrintTest: Basic output functionality
| Option | Description |
|---|---|
-f, --file <name> |
Run specific Java file (without .java extension) |
-l, --list |
List all available test files |
-c, --compile |
Force recompile Java files |
-q, --quiet |
Silent mode (no JVM debug output) |
-h, --help |
Show help information |
rust-jvm/
├── vm/ # Core JVM implementation
├── cli/ # Command-line interface
├── reader/ # Class file reader
├── test/ # Test cases directory
│ ├── TestProgram.java # Main test program
│ ├── SimpleStaticTest.java
│ └── SimplePrintTest.java
├── run_tests.sh # Test automation script
└── resources/ # JVM resources
# Development build
cargo build
# Release build
cargo build --release
# Run specific component
cargo run --bin vm- Create a new Java file in the
test/directory - Ensure it only uses Java 1.8 features
- Run with:
./run_tests.sh -f YourTestName
We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Follow Rust coding conventions
- Add tests for new features
- Ensure Java 1.8 compatibility
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Cursor - The AI-first code editor
- Inspired by the Java Virtual Machine Specification
- Community contributors and testers
- Cursor Editor - AI-powered code editor used for development
- Rust Programming Language
- Java 8 Documentation
- JVM Specification
使用 Rust 编写的 Java 1.8 兼容 JVM 实现,具备全面的测试自动化和现代开发实践。
- Java 1.8 兼容性: 完整支持 Java 1.8 字节码和语言特性
- 全面测试: 包含多种测试场景的自动化测试套件
- 现代架构: 清晰、模块化的 Rust 实现
- 便捷测试: 一键测试执行,智能编译
- 跨平台: 支持 macOS、Linux 和 Windows
- Rust (1.70 或更高版本)
- Java JDK 8 (用于编译和 rt.jar)
# 克隆仓库
git clone https://github.com/yourusername/rust-jvm.git
cd rust-jvm
# 构建项目
cargo build --release# 列出所有可用测试用例
./run_tests.sh -l
# 运行指定测试(自动编译)
./run_tests.sh -f TestProgram
# 强制重新编译并运行
./run_tests.sh -f TestProgram -c
# 交互式测试选择
./run_tests.sh- TestProgram: 全面的 JVM 功能测试
- SimpleStaticTest: 静态字段和方法测试
- SimplePrintTest: 基本输出功能测试
| 选项 | 描述 |
|---|---|
-f, --file <名称> |
运行指定的 Java 文件(不含 .java 扩展名) |
-l, --list |
列出所有可用的测试文件 |
-c, --compile |
强制重新编译 Java 文件 |
-q, --quiet |
静默模式(无 JVM 调试输出) |
-h, --help |
显示帮助信息 |
rust-jvm/
├── vm/ # 核心 JVM 实现
├── cli/ # 命令行界面
├── reader/ # 类文件读取器
├── test/ # 测试用例目录
│ ├── TestProgram.java # 主测试程序
│ ├── SimpleStaticTest.java
│ └── SimplePrintTest.java
├── run_tests.sh # 测试自动化脚本
└── resources/ # JVM 资源
# 开发构建
cargo build
# 发布构建
cargo build --release
# 运行指定组件
cargo run --bin vm- 在
test/目录下创建新的 Java 文件 - 确保只使用 Java 1.8 特性
- 运行:
./run_tests.sh -f YourTestName
我们欢迎贡献!请随时提交 Pull Request。对于重大更改,请先开一个 issue 来讨论您想要更改的内容。
- 遵循 Rust 编码约定
- 为新功能添加测试
- 确保 Java 1.8 兼容性
- 根据需要更新文档
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
- 使用 Cursor 构建 - AI 优先的代码编辑器
- 受 Java 虚拟机规范启发
- 社区贡献者和测试者
- Cursor 编辑器 - 用于开发的 AI 驱动代码编辑器
- Rust 编程语言
- Java 8 文档
- JVM 规范