From 0a45d6ca9b9a8d92b5e4c147be94fad8de344816 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 22 Sep 2011 00:29:59 +0200 Subject: JNILibLoaderBase/TempJarCache: Prepare for loadLibrary(..) out of cached JARs - JNILibLoaderBase: If TempJarCache is active, try find native library in cached JARs - TempJarCache: Add bootstrabNativeLib(..) allowing bootstraping gluegen-rt from JAR w/o needing it - JARUtil: minor edits (final) --- src/java/com/jogamp/common/jvm/JNILibLoaderBase.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/java/com/jogamp/common/jvm/JNILibLoaderBase.java') diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java index 161f0c4..44cbd14 100644 --- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java +++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java @@ -44,6 +44,9 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.AccessControlContext; import java.util.HashSet; + +import com.jogamp.common.util.cache.TempJarCache; + import jogamp.common.Debug; public class JNILibLoaderBase { @@ -148,7 +151,6 @@ public class JNILibLoaderBase { // private static final Class customLauncherClass; private static final Method customLoadLibraryMethod; - // FIXME centralize logging static { final String sunAppletLauncherProperty = "sun.jnlp.applet.launcher"; final String sunAppletLauncherClassName = "org.jdesktop.applet.util.JNLPAppletLauncher"; @@ -222,7 +224,22 @@ public class JNILibLoaderBase { throw (UnsatisfiedLinkError) new UnsatisfiedLinkError("can not load library "+libraryName).initCause(e); } } else { + if(TempJarCache.isInitialized()) { + final String fullLibraryName = TempJarCache.findLibrary(libraryName); + if(null != fullLibraryName) { + if(DEBUG) { + System.err.println("JNILibLoaderBase.loadLibraryInternal("+libraryName+") -> System.load("+fullLibraryName+") (TempJarCache)"); + } + System.load(fullLibraryName); + return; // done + } else if(DEBUG) { + System.err.println("JNILibLoaderBase.loadLibraryInternal("+libraryName+") -> TempJarCache not mapped"); + } + } // System.err.println("sun.boot.library.path=" + Debug.getProperty("sun.boot.library.path", false)); + if(DEBUG) { + System.err.println("JNILibLoaderBase.loadLibraryInternal("+libraryName+") -> System.loadLibrary("+libraryName+")"); + } System.loadLibrary(libraryName); } } -- cgit v1.2.3