How to setup java.library.path with native dependencies?


(Bálint Kriván) #1

Hi!

I have a problem with java.library.path and native dependencies. I’m trying to setup a project with sqlite4java. It has the native libraries as maven dependency, so:

dependencies {
  // ...
  runtime 'com.almworks.sqlite4java:sqlite4java-win32-x64:0.282'
}

works like a charm, I mean dll gets downloaded into /.gradle/caches/modules-2/files-2.1/…dll. My problem is how can I add these to java.library.path? I’m using this currently:

run {
 systemProperty "java.library.path", 'native-libs'
}

which requires that I’ve put the native libs into version control under the directory ‘native-libs’. It would be nice if I wouldn’t need it and the dependencies could be added. Anyone has encountered a situation like this and maybe has a solution?

Thanks!