diff options
author | Kenneth Russel <[email protected]> | 2007-06-28 22:13:59 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2007-06-28 22:13:59 +0000 |
commit | 8b70d401ecb07b21e79ad19e6e25a38c8ed46b1f (patch) | |
tree | 2d8171be5b22859615729ea81e76e0bbfe1a2641 /src | |
parent | bc2aa253bc6eb1a0d479833e007d8eae31610512 (diff) |
Added support for the new JNLPAppletLauncher (http://applet-launcher.dev.java.net/)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1281 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/com/sun/opengl/impl/NativeLibLoader.java | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java index aa5c4e236..91745d561 100644 --- a/src/classes/com/sun/opengl/impl/NativeLibLoader.java +++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java @@ -40,6 +40,7 @@ package com.sun.opengl.impl; import java.awt.Toolkit; +import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashSet; @@ -65,7 +66,7 @@ public class NativeLibLoader { if (doPreload) { for (int i=0; i<preload.length; i++) { try { - System.loadLibrary(preload[i]); + loadLibraryInternal(preload[i]); } catch (UnsatisfiedLinkError e) { if (!ignoreError && e.getMessage().indexOf("already loaded") < 0) { @@ -75,7 +76,7 @@ public class NativeLibLoader { } } - System.loadLibrary(libname); + loadLibraryInternal(libname); } } @@ -142,4 +143,39 @@ public class NativeLibLoader { } }); } + + //---------------------------------------------------------------------- + // Support for the new JNLPAppletLauncher + // + + private static boolean usingJNLPAppletLauncher; + private static Method jnlpLoadLibraryMethod; + + static { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String sunAppletLauncher = System.getProperty("sun.jnlp.applet.launcher"); + usingJNLPAppletLauncher = Boolean.valueOf(sunAppletLauncher).booleanValue(); + return null; + } + }); + } + + // I hate the amount of delegation currently in this class + private static void loadLibraryInternal(String libraryName) { + // Note: special-casing JAWT which is built in to the JDK + if (usingJNLPAppletLauncher && !libraryName.equals("jawt")) { + try { + if (jnlpLoadLibraryMethod == null) { + Class jnlpAppletLauncherClass = Class.forName("org.jdesktop.applet.util.JNLPAppletLauncher"); + jnlpLoadLibraryMethod = jnlpAppletLauncherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class }); + } + jnlpLoadLibraryMethod.invoke(null, new Object[] { libraryName }); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + System.loadLibrary(libraryName); + } + } } |