Skip to content

rodbate/jvm-on-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jvm On Go

使用golang基于JVM8 Spec 构建的简易JVM,仅供学习使用。

Roadmap

  • 类加载
  • 字节码解析
  • 类解析及初始化
  • 字节码解释器
  • 单线程
  • 部分Native方法(使用golang实现)
  • invokedynamic
  • Lambda

Getting Started

1. 环境准备

  • 本地需要Java8运行环境并且设置JAVA_HOME环境变量
  • 若是通过源码构建,本地需要安装golang(>= 1.15)

2. 源码构建

git clone https://github.com/rodbate/jvm-on-go.git
cd jvm-on-go && go build -o jvm

3. 下载二进制包

#windows
wget https://github.com/rodbate/jvm-on-go/releases/download/1.0.0/jvm-windows

#linux
wget https://github.com/rodbate/jvm-on-go/releases/download/1.0.0/jvm-linux

#mac os
wget https://github.com/rodbate/jvm-on-go/releases/download/1.0.0/jvm-darwin

以上都是基于64位系统

4. 使用

testdata目录下有几个简单的java示例

比如:

//ChineseSupportSample.java
//ChineseSupportSample.class
public class ChineseSupportSample {
    public static void main(String[] args) {
        for (int i = 0; i < 1000; i++) {
            System.out.println("中文 - Hello world: " + i);
        }
    }
}

输入以下命令即可运行

./jvm run -c testdata ChineseSupportSample

About

Simple jvm built on golang! Just for learning!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages