org.fusesource.hawtjni.runtime
Class Library
java.lang.Object
org.fusesource.hawtjni.runtime.Library
public class Library
- extends java.lang.Object
Used to optionally extract and load a JNI library.
It will search for the library in order at the following locations:
- in the custom library path: If the "library.${name}.path" System property is set to a directory
- "${name}-${version}" if the version can be determined.
- "${name}"
- system library path: This is where the JVM looks for JNI libraries by default.
- "${name}-${version}" if the version can be determined.
- "${name}"
- classpath path: If the JNI library can be found on the classpath, it will get extracted
and and then loaded. This way you can embed your JNI libraries into your packaged JAR files.
They are looked up as resources in this order:
- "META-INF/native/${platform}/${library}" : Store your library here if you want to embed more
than one platform JNI library in the jar.
- "META-INF/native/${library}": Store your library here if your JAR is only going to embedding one
platform library.
The file extraction is attempted until it succeeds in the following directories.
- The directory pointed to by the "library.${name}.path" System property (if set)
- a temporary directory (uses the "java.io.tmpdir" System property)
where:
- "${name}" is the name of library
- "${version}" is the value of "library.${name}.version" System property if set.
Otherwise it is set to the ImplementationVersion property of the JAR's Manifest
- "${os}" is your operating system, for example "osx", "linux", or "windows"
- "${bit-model}" is "64" if the JVM process is a 64 bit process, otherwise it's "32" if the
JVM is a 32 bit process
- "${platform}" is "${os}${bit-model}", for example "linux32" or "osx64"
- "${library}": is the normal jni library name for the platform. For example "${name}.dll" on
windows, "lib${name}.jnilib" on OS X, and "lib${name}.so" on linux
- Author:
- Hiram Chirino
Constructor Summary |
Library(java.lang.String name)
|
Library(java.lang.String name,
java.lang.Class<?> clazz)
|
Library(java.lang.String name,
java.lang.String version)
|
Library(java.lang.String name,
java.lang.String version,
java.lang.ClassLoader classLoader)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Library
public Library(java.lang.String name)
Library
public Library(java.lang.String name,
java.lang.Class<?> clazz)
Library
public Library(java.lang.String name,
java.lang.String version)
Library
public Library(java.lang.String name,
java.lang.String version,
java.lang.ClassLoader classLoader)
getOperatingSystem
public static java.lang.String getOperatingSystem()
getPlatform
public static java.lang.String getPlatform()
getBitModel
public static int getBitModel()
load
public void load()
getOperatingSystemSpecifcResourcePath
public final java.lang.String getOperatingSystemSpecifcResourcePath()
getPlatformSpecifcResourcePath
public final java.lang.String getPlatformSpecifcResourcePath()
getPlatformSpecifcResourcePath
public final java.lang.String getPlatformSpecifcResourcePath(java.lang.String platform)
getResorucePath
public final java.lang.String getResorucePath()
getLibraryFileName
public final java.lang.String getLibraryFileName()