Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Procedures for creating and loading shared libraries are platform dependent. This page provides some answers regarding naming conventions for shared libraries and locating shared libraries.
Each Java runtime environment provides a platform-dependent mechanism for
mapping between the actual file name of a shared library and the name string
that you pass as an argument to the System.loadLibrary
method.
The shared library file name requires a "lib" prefix and a ".so" extension.
Do not include the "lib" prefix or the ".so" extension for the argument that you pass to the
System.loadLibrary method
.
The shared library file name requires a ".dll" extension. Do not include the
".dll" extension for the System.loadLibrary
method argument.
No special conventions.
Each Java runtime environment provides its own mechanism that indicates where to find shared libraries for native method implementations. The platform-dependent wrapper script or application shell can use the appropriate mechanism to indicate where shared libraries are located.
The LD_LIBRARY_PATH
environment variable defines a list of directories that the Solaris VM searches for
shared libraries.
The Microsoft Windows VM uses a search path that includes
the current directory for the process or one of the directories listed in the PATH
environment variable.
The Code Fragment Manager provides the search mechanism used by the MRJ VM to find and load a shared
library. This search path
includes the application folder that contains the Macintosh Java application
shell generated by JBindery
.
To avoid file name conflicts, it is best to prepend directories or folders
containing shared libraries to search paths, such as the LD_LIBRARY_PATH
or PATH
environment variables.
Because a Java application with native methods may support multiple platforms, it
helps to organize multiple shared libraries into sub-directories by platform, such as
<app-dir>/lib/<platform>
.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.