public class NativeLibraryUtil extends Object
Native libraries should be packaged into a single jar file, with the following directory & file structure:
META_INF lib linux_32 libxxx[-vvv].so linux_64 libxxx[-vvv].so osx_32 libxxx[-vvv].dylib osx_64 libxxx[-vvv].dylib windows_32 xxx[-vvv].dll windows_64 xxx[-vvv].dll
Here "xxx" is the name of the native library and "-vvv" is an optional version number.
Current approach is to unpack the native library into a temporary file and load from there.
| Modifier and Type | Class and Description |
|---|---|
static class |
NativeLibraryUtil.Architecture |
| Constructor and Description |
|---|
NativeLibraryUtil() |
| Modifier and Type | Method and Description |
|---|---|
static NativeLibraryUtil.Architecture |
getArchitecture()
Determines the underlying hardware platform and architecture.
|
static String |
getPlatformLibraryName(String libName)
Returns the full file name (without path) of the native library.
|
static String |
getPlatformLibraryPath()
Returns the path to the native library.
|
static String |
getVersionedLibraryName(Class libraryJarClass,
String libName)
Returns the Maven-versioned file name of the native library.
|
static boolean |
loadNativeLibrary(Class libraryJarClass,
String libName)
Loads the native library.
|
static boolean |
loadVersionedNativeLibrary(Class libraryJarClass,
String libName)
Loads the native library.
|
public static NativeLibraryUtil.Architecture getArchitecture()
public static String getPlatformLibraryPath()
public static String getPlatformLibraryName(String libName)
libName - public static String getVersionedLibraryName(Class libraryJarClass, String libName)
libName - public static boolean loadVersionedNativeLibrary(Class libraryJarClass, String libName)
libraryJarClass - any class within the library-containing jarlibName - name of libraryCopyright © 2010–2015 SciJava. All rights reserved.