Loading Native library in version 5.0, 5.1 and 6.0
 Technote (FAQ)
 
Problem
How to load Native library in version 5.0, 5.1 and 6.0 to avoid getting "UnsatisfiedLinkError" error , "Library not found" exceptions.
 
Cause
The native library will be loaded depends on which classloader loaded the class
that calls System.loadLibrary(). if that class is in the shared library, then library should be picked up by shared library on native lib path of shared library otherwise, by JVM classloader on java.library.path . If the System.loadLibrary() method is called by any other classloader then it will try to find it from the Java Library Path and will fail , if not defined on the JVM classpath. It wont search the native library in hierarchy like other dependent class files.
 
Solution
Load the native library path in the JVM Classpath, if you are not sure, on which classloader you make the System.loadLibrary() call. Also please remove the native library path from the shared library, if you are going to define it in the JVM Classpath.

Each operating system has a different name for the environment variable to include native libraries in your path.


AIX®

LIBPATH

Linux®

LD_LIBRARY_PATH

Solaris™

LD_LIBRARY_PATH

HP-UX:

SHLIB_PATH

Microsoft® Windows®

PATH

Setting the Environment Entries from the administrative console
  • Open Servers > Application Servers > server_name > Java and Process Management > Process Definition > Environment Entries > New
  • To set the following Environment Entries from the administrative console for websphere application server 6.0.2 or Higher.
    Open Servers > Application servers > server_name > Java and Process Management > Process Definition > Custom Properties > New

    1. Type the Name and Value for your environment variables:

    Example for Microsoft Windows:
    Name: PATH
    Value
    : library_path

    where library_pathis the path for the native library

    2. Apply and save all changes.

    3. Restart the application server.

 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > System Management/Repository
Operating system(s): Windows
Software version: 6.0
Software edition:
Reference #: 1215903
IBM Group: Software Group
Modified date: Dec 13, 2005