timob / jnigi

Golang Java JNI library
BSD 2-Clause "Simplified" License
163 stars 44 forks source link

Make loading JVM a package function #20

Closed timob closed 4 years ago

timob commented 5 years ago

Re: https://github.com/timob/jnigi/commit/4a6d12459ba7cd175426a185b96cb357338cfe3b#r33728275 There has been some discussion on what is the best practice to load the JVM at runtime, i think we can probably make it not JNIGI's problem and just provide a function:

func LoadJVM(jvmSharedLibraryPath string) error

This will replace the current init() function, then the program using JNIGI can decide how it wants to find the library.

timob commented 4 years ago

I think this is a good solution for the runtime finding of the shared library.

For compile time: i think it should be

# put this in your build script
source <gopath>/src/github.com/timob/jnigi/compilevars.sh <root path of jdk>

and remove the current install script, which doesnt work because go recompiles the package when building an app usually. I'll do an issue...

timob commented 4 years ago

PR for this https://github.com/timob/jnigi/pull/25

timob commented 4 years ago

in master