Zaid Amir
Zaid Amir

Reputation: 4785

Best way to distribute an application that uses JNI

I am currently working on a Windows desktop application that uses JNI to call methods located inside a jar file.

I need to know the best way to package my application so that it can link to jvm.dll. I am not sure if I should package all the binaries found inside the JDK's bin directory into my setup file (not sure if I am allowed to do so)?

The problem is all examples found online links directly the jvm.dll found in the JDK installation path. And since my application is a commercial one, I cannot rely or ask that every user should install the JDK along side my app because that would be ridiculous.

Please can someone clarify the best method to package such application?

Regards

Upvotes: 3

Views: 321

Answers (1)

Botz3000
Botz3000

Reputation: 39620

jvm.dll is also installed with the normal java runtime (bin/client subdirectory). By checking some registry values, you can find the path to it, load it from there and check whether the correct version is installed. If you have already linked jvm.lib, you'll then need to add jvm.dll to the list of delay loaded dlls, so you can load it at runtime.

See my recent answer to another question for details:
https://stackoverflow.com/a/14434203/93652

Upvotes: 2

Related Questions