From 65d923c910b4d90b91407f6d5fe266bc8e6571b1 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 4 Jul 2007 01:15:31 +0000 Subject: Updated NativeLibLoader to work with JNLPAppletLauncher git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@67 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- .../com/sun/gluegen/runtime/NativeLibLoader.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/java/com/sun/gluegen/runtime/NativeLibLoader.java') diff --git a/src/java/com/sun/gluegen/runtime/NativeLibLoader.java b/src/java/com/sun/gluegen/runtime/NativeLibLoader.java index 4d57867..a879683 100755 --- a/src/java/com/sun/gluegen/runtime/NativeLibLoader.java +++ b/src/java/com/sun/gluegen/runtime/NativeLibLoader.java @@ -39,6 +39,7 @@ package com.sun.gluegen.runtime; +import java.lang.reflect.Method; import java.security.*; /** Class providing control over whether GlueGen loads the native code @@ -65,7 +66,7 @@ public class NativeLibLoader { didLoading = true; AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - System.loadLibrary("gluegen-rt"); + loadLibraryInternal("gluegen-rt"); return null; } }); @@ -73,4 +74,21 @@ public class NativeLibLoader { } } } + + private static void loadLibraryInternal(String libraryName) { + String sunAppletLauncher = System.getProperty("sun.jnlp.applet.launcher"); + boolean usingJNLPAppletLauncher = Boolean.valueOf(sunAppletLauncher).booleanValue(); + + if (usingJNLPAppletLauncher) { + try { + Class jnlpAppletLauncherClass = Class.forName("org.jdesktop.applet.util.JNLPAppletLauncher"); + Method 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); + } + } } -- cgit v1.2.3