2016-03-28 20:13:19 +02:00
## GoJava - Java bindings to Go packages [](https://travis-ci.org/sridharv/gojava)
2016-03-27 19:53:45 +02:00
2016-03-27 22:36:00 +02:00
GoJava uses a [forked version of gomobile ](https://github.com/sridharv/gomobile-java ) to generate Java bindings to Go packages.
The same set of types are supported. Details on how the binding works can be found [here ](https://godoc.org/golang.org/x/mobile/cmd/gobind ).
### Usage
```
2016-04-12 09:23:05 -06:00
gojava [-v] [-o < jar > ] [-s < dir > ] build [< pkg1 > , [< pkg2 > ...]]
This generates a jar containing Java bindings to the specified Go packages.
-o string
Path to write the generated jar file. (default "libgojava.jar")
-s string
Additional path to scan for Java files. These files will be compiled and
included in the final jar.
-v Verbose output.
2016-03-27 22:36:00 +02:00
```
You can include the generated jar in your build using the build tool of your choice.
The jar contains a native library (built for the build platform) which is loaded automatically.
Cross platform builds are not currently supported.
2016-03-28 20:18:41 +02:00
NOTE: This has only been tested on an OSX developer machine and Linux (on Travis) and not in production.