Package com.jogamp.common.jvm
Class JNILibLoaderBase
java.lang.Object
com.jogamp.common.jvm.JNILibLoaderBase
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic booleanaddNativeJarLibs(Class<?>[] classesFromJavaJars, String singleJarMarker) Loads and adds a JAR file's native library to the TempJarCache.
The native library JAR file's URI is derived as follows: [1]GLProfile.class-> [2]http://lala/gluegen-rt.jar-> [3]http://lala/gluegen-rt-> [4]http://lala/gluegen-rt-natives-'os.and.arch'.jarWhere: [1] is one ofclassesFromJavaJars[2] is it's complete URI [3] is it's base URI [4] is the derived native JAR filenamestatic final booleanaddNativeJarLibsJoglCfg(Class<?>[] classesFromJavaJars) Loads and adds a JAR file's native library to the TempJarCache, callingaddNativeJarLibs(Class[], String)with default JOGL deployment configuration:static voidstatic voidstatic booleanprotected static booleanloadLibrary(String libname, boolean ignoreError, ClassLoader cl) Loads the library specified by libname, using theJNILibLoaderBase.LoaderActionset bysetLoadingAction(LoaderAction).
The implementation should ignore, if the library has been loaded already.protected static voidloadLibrary(String libname, String[] preload, boolean preloadIgnoreError, ClassLoader cl) Loads the library specified by libname, using theJNILibLoaderBase.LoaderActionset bysetLoadingAction(LoaderAction).
Optionally preloads the libraries specified by preload.
The implementation should ignore, if any library has been loaded already.static void
-
Field Details
-
DEBUG
public static final boolean DEBUG -
PERF
protected static final boolean PERF
-
-
Constructor Details
-
JNILibLoaderBase
public JNILibLoaderBase()
-
-
Method Details
-
isLoaded
-
addLoaded
-
disableLoading
public static void disableLoading() -
enableLoading
public static void enableLoading() -
setLoadingAction
-
addNativeJarLibsJoglCfg
Loads and adds a JAR file's native library to the TempJarCache, callingaddNativeJarLibs(Class[], String)with default JOGL deployment configuration:return JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all");IfClass1.classis contained in a JAR file which name includessingleJarMarker-all, implementation will attempt to resolve the native JAR file as follows:- ClassJar-all.jar to ClassJar-all-natives-os.and.arch.jar
- ClassJar1.jar to ClassJar1-natives-os.and.arch.jar
- ClassJar2.jar to ClassJar2-natives-os.and.arch.jar
- ..
-
addNativeJarLibs
Loads and adds a JAR file's native library to the TempJarCache.
The native library JAR file's URI is derived as follows:- [1]
GLProfile.class-> - [2]
http://lala/gluegen-rt.jar-> - [3]
http://lala/gluegen-rt-> - [4]
http://lala/gluegen-rt-natives-'os.and.arch'.jar
- [1] is one of
classesFromJavaJars - [2] is it's complete URI
- [3] is it's base URI
- [4] is the derived native JAR filename
Generic description:
final Class<?>[] classesFromJavaJars = new Class<?>[] { Class1.class, Class2.class }; JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all");IfClass1.classis contained in a JAR file which name includessingleJarMarker, here -all, implementation will attempt to resolve the native JAR file as follows:- ClassJar-all.jar to ClassJar-all-natives-os.and.arch.jar
- Class1Jar.jar to Class1Jar-natives-os.and.arch.jar
- Class2Jar.jar to Class2Jar-natives-os.and.arch.jar
Examples:
JOCL:
// only: jocl.jar -> jocl-natives-os.and.arch.jar addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.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<?>[] { NWJNILibLoader.class, GLProfile.class, null }; if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) { classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl); } JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all");- Parameters:
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.- Returns:
- true if either the 'all-in-one' native JAR or all native JARs loaded successful or were loaded already, false in case of an error
- [1]
-
loadLibrary
Loads the library specified by libname, using theJNILibLoaderBase.LoaderActionset bysetLoadingAction(LoaderAction).
The implementation should ignore, if the library has been loaded already.- Parameters:
libname- the library to loadignoreError- if true, errors during loading the library should be ignoredcl- optional ClassLoader, used to locate the library- Returns:
- true if library loaded successful
-
loadLibrary
protected static void loadLibrary(String libname, String[] preload, boolean preloadIgnoreError, ClassLoader cl) Loads the library specified by libname, using theJNILibLoaderBase.LoaderActionset bysetLoadingAction(LoaderAction).
Optionally preloads the libraries specified by preload.
The implementation should ignore, if any library has been loaded already.- Parameters:
libname- the library to loadpreload- the libraries to load before loading the main library if not nullpreloadIgnoreError- if true, errors during loading the preload-libraries should be ignoredcl- optional ClassLoader, used to locate the library
-