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
- Host: GitHub
- URL: https://github.com/dqneo/gojvm
- Owner: DQNEO
- License: mit
- Created: 2019-09-11T15:20:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-14T01:34:09.000Z (over 6 years ago)
- Last Synced: 2025-04-20T13:36:20.066Z (9 months ago)
- Topics: go, java, jvm, vm
- Language: Go
- Size: 1.12 MB
- Stars: 98
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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