Skip to content

Latest commit

 

History

History
67 lines (46 loc) · 1.1 KB

README.md

File metadata and controls

67 lines (46 loc) · 1.1 KB

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