jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
Static JNI Native Libraries handler including functionality for native JAR files using JarUtil
and TempJarCache
.
More...
Static Public Member Functions | |
static boolean | addNativeJarLibs (final Class<?>[] classesFromJavaJars, final String singleJarMarker) |
Loads and adds a JAR file's native library to the TempJarCache. More... | |
Static Public Member Functions inherited from org.jau.sys.JNILibrary | |
static final String | getSystemEnvLibraryPathVarname () |
Returns the system's environment variable name used for the dynamic linker to resolve library locations, e.g. More... | |
static final List< String > | getSystemEnvLibraryPaths () |
Returns a list of system paths, from the getSystemEnvLibraryPathVarname() variable. More... | |
static synchronized boolean | isLoaded (final String libName) |
static synchronized boolean | loadLibrary (final String libname, final boolean ignoreError, final ClassLoader cl) throws SecurityException, UnsatisfiedLinkError |
Loads the library specified by libname. More... | |
static synchronized void | loadLibrary (final String libname, final String[] preload, final boolean preloadIgnoreError, final ClassLoader cl) throws SecurityException, UnsatisfiedLinkError |
Loads the library specified by libname. More... | |
static final String | findLibrary (final String libName, final ClassLoader loader) |
static final String | isValidNativeLibraryName (final String libName, final boolean isLowerCaseAlready) |
Comparison of prefix and suffix of the given libName's basename is performed case insensitive More... | |
static final List< String > | enumerateLibraryPaths (final String libName, final boolean searchSystemPath, final boolean searchSystemPathFirst, final ClassLoader loader) |
Given the base library names (no prefixes/suffixes) for the various platforms, enumerate the possible locations and names of the indicated native library on the system using the system path. More... | |
static final List< String > | enumerateLibraryPaths (final String windowsLibName, final String unixLibName, final String macOSXLibName, final boolean searchSystemPath, final boolean searchSystemPathFirst, final ClassLoader loader) |
Given the base library names (no prefixes/suffixes) for the various platforms, enumerate the possible locations and names of the indicated native library on the system using the system path. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from org.jau.sys.JNILibrary | |
static final boolean | DEBUG |
Static Protected Attributes inherited from org.jau.sys.JNILibrary | |
static final boolean | PERF |
static final Object | perfSync = new Object() |
static long | perfTotal = 0 |
static long | perfCount = 0 |
Static JNI Native Libraries handler including functionality for native JAR files using JarUtil
and TempJarCache
.
Definition at line 42 of file JNIJarLibrary.java.
|
static |
Loads and adds a JAR file's native library to the TempJarCache.
The native library JAR file's URI is derived as follows:
GLProfile.class
-> http://lala/gluegen-rt.jar
-> http://lala/gluegen-rt
-> http://lala/gluegen-rt-natives-'os.and.arch'.jar
Where:
classesFromJavaJars
Generic description:
final Class<?>[] classesFromJavaJars = new Class<?>[] { Class1.class, Class2.class }; JNIJarLibrary.addNativeJarLibs(classesFromJavaJars, "-all");
If Class1.class
is contained in a JAR file which name includes singleJarMarker
, here -all, implementation will attempt to resolve the native JAR file as follows:
Otherwise the native JAR files will be resolved for each class's JAR file:
Examples:
JOCL:
// only: jocl.jar -> jocl-natives-os.and.arch.jar addNativeJarLibs(new Class<?>[] { JOCLJNILibrary.class }, null, null );
JOGL:
final ClassLoader cl = GLProfile.class.getClassLoader(); // jogl-all.jar -> jogl-all-natives-os.and.arch.jar // jogl-all-noawt.jar -> jogl-all-noawt-natives-os.and.arch.jar // jogl-all-mobile.jar -> jogl-all-mobile-natives-os.and.arch.jar // jogl-all-android.jar -> jogl-all-android-natives-os.and.arch.jar // nativewindow.jar -> nativewindow-natives-os.and.arch.jar // jogl.jar -> jogl-natives-os.and.arch.jar // newt.jar -> newt-natives-os.and.arch.jar (if available) final String newtFactoryClassName = "com.jogamp.newt.NewtFactory"; final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibrary.class, GLProfile.class, null }; if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) { classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl); } JNIJarLibrary.addNativeJarLibs(classesFromJavaJars, "-all");
classesFromJavaJars | For each given Class, load the native library JAR. |
singleJarMarker | Optional string marker like "-all" to identify the single 'all-in-one' JAR file after which processing of the class array shall stop. |
Definition at line 252 of file JNIJarLibrary.java.