diff options
Diffstat (limited to 'src/java/com/sun/gluegen/runtime')
-rwxr-xr-x | src/java/com/sun/gluegen/runtime/NativeLibLoader.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/java/com/sun/gluegen/runtime/NativeLibLoader.java b/src/java/com/sun/gluegen/runtime/NativeLibLoader.java index a879683..0e6e3da 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.InvocationTargetException; import java.lang.reflect.Method; import java.security.*; @@ -85,7 +86,17 @@ public class NativeLibLoader { Method jnlpLoadLibraryMethod = jnlpAppletLauncherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class }); jnlpLoadLibraryMethod.invoke(null, new Object[] { libraryName }); } catch (Exception e) { - throw new RuntimeException(e); + Throwable t = e; + if (t instanceof InvocationTargetException) { + t = ((InvocationTargetException) t).getTargetException(); + } + if (t instanceof Error) + throw (Error) t; + if (t instanceof RuntimeException) { + throw (RuntimeException) t; + } + // Throw UnsatisfiedLinkError for best compatibility with System.loadLibrary() + throw (UnsatisfiedLinkError) new UnsatisfiedLinkError().initCause(e); } } else { System.loadLibrary(libraryName); |