http://www.inonit.com/cygwin/jni/helloWorld/load.html
There are two different ways to load a native library into a running Java program: System.loadLibrary(String) and System.load(String). The System.loadLibrary method allows us to load a library from the "default" path. System.load allows us to load a library from anywhere via its absolute path. First, System.loadLibrary. We'll use System.loadLibrary for our example because most other examples use it, and because we're doing all of our work in one directory. When using System.loadLibrary, the only thing we specify is the name of the DLL file we want. The JVM will search for it in the "Java library path." This is a path which is given by the java.library.path system property (and hence can be altered on the java.exe command line using the -D option). The default value of this appears to be related to the Windows path, though it appears to be somewhat scrambled, and I'm not quite sure how or why. In other words, I'm not sure how the Windows JVM creates the initial value of java.library.path. This is the default on my system: java.library.path=C:/WINNT/system32;.;C:/WINNT/System32;C:/WINNT;c:/applications/asc/pervasive/BIN;c:/cygwin/bin; C:/WINNT/system32;C:/WINNT;C:/WINNT/System32/Wbem;/win32 C:/>echo %PATH% c:/applications/asc/pervasive/BIN;c:/cygwin/bin;C:/WINNT/system32;C:/WINNT;C:/WINNT/System32/Wbem;/win32Note that the current directory is inserted into the PATH; I believe that this is something that Windows does by default. I am going to execute the program from the directory in which HelloWorld.dll was created, so I won't have to mess with java.library.path. One could also use command-line options to alter java.library.path or simply copy the DLL into one of the Windows directories.