An open API service indexing awesome lists of open source software.

https://github.com/dqneo/gojvm

JVM implementation by Go
https://github.com/dqneo/gojvm

go java jvm vm

Last synced: 9 months ago
JSON representation

JVM implementation by Go

Awesome Lists containing this project

README

          

# 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

```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

```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](https://github.com/php-java/php-java).

I really appreciate the work.

# License

MIT

# Author

@DQNEO