public class NativeLibraryHelper extends Object
<library-path>/<os>-<arch>/<lib-prefix><lib-name>[<debug-suffix>].<ext>where:
library-path is specified by the user on the load(String, String) methodos is one of:
win on Windows platforms
linux on Linux platforms
unix on UNIX-like platforms
mac on Mac OS platforms
other on other platforms
arch is either x86 or x64lib-prefix is either lib or nothing, depending on the platform
(typically Linux and UNIX-like platforms adopt lib, whereas Windows platforms do not use a prefix)lib-name is the library name, specified by the user on the load(String, String) methodext is the library extension, according to the platform standards
(dll on Windows, so on Linux and UNIX-like platforms, and dylib on Mac OS)debug-suffix is an optional debug suffix for the debug versions of the libraries. The debug versions can be
loaded by setting the system property native.debug to true. The default debug suffix is "-d" and
can be changed through the system property native.debug.suffix
Files are extracted to the path specified by the system property native.lib.path. If the property is not
specified, libraries will be extracted to the lib folder under the working directory.
| Modifier and Type | Method and Description |
|---|---|
static void |
load(String path,
String libName)
Loads a native library using the system class loader.
|
static void |
load(String path,
String libName,
ClassLoader cl)
Loads a native library using the given class loader.
|
public static void load(String path, String libName) throws IOException
path - the base path for the librarylibName - the library nameIOException - if there is a problem reading or writing the librarypublic static void load(String path, String libName, ClassLoader cl) throws IOException
path - the base path for the librarylibName - the library namecl - the ClassLoader to use to load the libraryIOException - if there is a problem reading or writing the libraryCopyright © 2018. All rights reserved.