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