One Star

how to specify java.library.path for a native library?

My component requires a native DLL on Windows. I tried copying the DLL into the component directory, but it?s not finding it. (UnsatisfiedLinkError). How do I ensure that the java.library.path is set correctly to include my DLL?
I saw advice in another thread to copy the DLL into windows/system32, but it's hard to maintain when code is buried in a system directory. Is there another way?
I looked in the XML for one other component that has a DLL (tPaloOutput) but I couldn?t see anything relating to this in the XML file.

Re: how to specify java.library.path for a native library?

Hi Geoffrey,
if we are talking about a JNI Implementation then you call the DLL direkt over
System.loadLibrary("<LIBNAME WITHOUT EXTENSION>");
The first function try to find the DLL in the main folder. In the second case you can add a directory name.
Normally TOS is looking for the DLL inside the main folder. There where the *.bat or *.sh Files for TOS starting
are located. Problem could be if you try to debug or export and run the generated script! The easiest way is to store
you mapping DLL inside your JAR and at the runtime level you will make the export from this file. Afterwards you
call System.loadLibrary().
Hope that helps?