libpd on java UnsatisfiedLinkError

228 Views Asked by At

I am doing my first attempts to use libpd with java. The IDE I am using is NetBeans. For libpd I am using these binary builds for Java. When running the code I get a java.lang.UnsatisfiedLinkError. At some poit it says:

Can't find dependent libraries

I've seen a similar question answered for Android, but not for Java.

EDIT: this is the full error-message:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\jaiserpe\AppData\Local\Temp\pdnative7141399841793639340.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821) at java.lang.Runtime.load0(Runtime.java:809) at java.lang.System.load(System.java:1086) at org.puredata.core.NativeLoader.loadLibraryFromJar(NativeLoader.java:121) at org.puredata.core.NativeLoader.loadLibrary(NativeLoader.java:97) at org.puredata.core.PdBase.(PdBase.java:59) at holamundo.HolaMundo.main(HolaMundo.java:26) C:\Users\jaiserpe\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

2

There are 2 best solutions below

4
On

It seems that you are missing dependent libraries of libpd.

You can use DepndencyWalker to inspect what is missing.

If you think that all required libraries are there, make sure that they are visible to JVM for loading. More info about loading DLLs on Windows here.

0
On

Those DLLs were built with MinGW. Using the technique here http://comments.gmane.org/gmane.comp.gnu.mingw.user/38834 the required DLLs for those builds are:

$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86_64/pthreadGC2.dll | grep 'DLL Name'
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: WS2_32.dll
$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86_64/pdnative.dll | grep 'DLL Name'
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: msvcrt.dll
    DLL Name: pthreadGC2.dll
    DLL Name: WS2_32.dll
$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86/pdnative.dll | grep 'DLL Name'
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: msvcrt.dll
    DLL Name: pthreadGC2.dll
    DLL Name: WS2_32.dll
$ x86_64-w64-mingw32-objdump --all-headers java-build/org/puredata/core/natives/windows/x86/pthreadGC2.dll | grep 'DLL Name'
    DLL Name: KERNEL32.dll
    DLL Name: msvcrt.dll
    DLL Name: WS2_32.dll

If all those dependencies are no longer found on the system, or just out of date, perhaps recompiling the DLLs would work for you.

Good luck.