DQNEO / gojvm

JVM implementation by Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gojvm

gojvm is an JVM implementation by Go.

It can interpret and run a JVM bytecode file. Currently, it only supports "hello world" and arithmetic addition.

Usage

Hello world

HelloWorld.java

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello world");
    }
}
$ cat HelloWorld.class | go run main.go                                                                                                 (git)-[master]  (p9)
Hello world

Arithmetic addition

Arith.java

public class Arith {
    public static void main(String[] args) {
        int c = sum(30, 12);
        System.out.println(c);
    }

    private static int sum(int a, int b) {
        return a + b;
    }
}
$ cat Arith.class | go run main.go                                                                                                         (git)-[master] ? 
42

How to test

make test

Acknowledgment

gojvm is inspired by PHPJava.

I really appreciate the work.

License

MIT

Author

@DQNEO

About

JVM implementation by Go

License:MIT License


Languages

Language:Go 96.1%Language:Java 1.8%Language:Shell 1.7%Language:Makefile 0.4%