I am using JNI (Java-Native-Interface) to acess some code that was written in c++. Everything works fine when I run the code from the command line but when I add the code to my Intellij project (class, header-file and dll) it gives the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Robin\Desktop\egdb_example\end.dll: Can't find dependent libraries
My Java Code looks like this :
public class EndGame {
public static native void openDataBase(int maxPieces, int buffer);
public static native void test();
public static native int lookUp(int condition, int BP, int WP, int K, int color);
public static native void close();
static {
System.load("C:\\Users\\Robin\\Desktop\\egdb_example\\end.dll");
}
public static void main(String[] args) {
System.out.println("Kleiner Test");
openDataBase(8, 2000);
int value = lookUp(0, 0, 0, 0, 0);
close();
}
}
I checked whether the path is actually correct running this piece of code
File test = new File("C:\\Users\\Robin\\Desktop\\egdb_example");
for (File file : test.listFiles()){
System.out.println(file.getName());
}
which produces the outcome:
.git
.gitattributes
.gitignore
egdb.h
egdb.lib
egdb64.dll
egdb64.lib
egdb_example.cpp
egdb_example.vcxproj
egdb_example.vcxproj.filters
end.dll
EndGame.class
EndGame.h
EndGame.java
jni.h
jni_md.h
main.cpp
Readme.pdf
robin.cpp
robin.exe
Would appreciate any help