I have a Java (JVM) library that I would like to u...
# kotlin-native
p
I have a Java (JVM) library that I would like to use in my native code. What is the best way to call JVM functions from native? Do I have to use JNI to make it work. Or is there a better solution?
c
If you need a Java library, why would you use Native?
p
Because we are creating a Windows app that is relying on the WIN32 API and we already have a couple of C interops set up. We have the problem that a client wants a specific Java library that is not available for native. It wouldn't make sense for us to port the whole project to JVM just so the client can use that one library.
c
Well — the easiest way might be just choosing another library — for C for example. If you really need one for Java, there might be a problem
h
I have not tried it myself but the GraalVm offers "polyglot" support, and claims to allow to interoperate any number
p
Yeah of course the best would be to have a Kotlin or C library available, but unfortunately that is not the case.