UnsatisfiedLinkError exception

Printer-friendly

Q: When accessing jNetPcap API I get this exception thrown: "UnsatisfiedLinkError".

A: The exception is thrown when you access a method that requires the native jnetpcap shared library (.dll or .so library on different systems) and its not found.

The library is supplied with jNetPcap. You need to ensure that you correctly define on each particular system, the folder or directory where the library is located.

You can use a OS specific environment variable to define the directory where the library resides or you can tell java VM directly using -Djava.library.path=path bypassing and overriding any environmental settings. Notice that its directory path not a fully qualified path to the library itself. Another words don't include the name of the library file in the path, just the directory.

On Unix systems

On any unix system make sure that that variable is exported in the environment

LD_LIBRARY_PATH=/usr/lib

On Win32 systems

In your c:\autoexec.bat
set path="%path%;/windows/system32"