aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2007-10-09 18:29:40 +0000
committerKevin Rushforth <[email protected]>2007-10-09 18:29:40 +0000
commit3711e80a6191e5adca5e3ef027882912746ed064 (patch)
tree2f8b0a9b19be0630c61e92ef8b46c572eef77425 /src
parenta408ebecbfbbb8622a252390758afbcf1acba665 (diff)
Fixed issue 534: ClassNotFoundException when running applet if Java 3D installed into JRE
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@870 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src')
-rw-r--r--src/classes/share/javax/media/j3d/NativePipeline.java32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/classes/share/javax/media/j3d/NativePipeline.java b/src/classes/share/javax/media/j3d/NativePipeline.java
index dcdf8a5..2df39c2 100644
--- a/src/classes/share/javax/media/j3d/NativePipeline.java
+++ b/src/classes/share/javax/media/j3d/NativePipeline.java
@@ -15,6 +15,7 @@ package javax.media.j3d;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.io.File;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.util.ArrayList;
@@ -180,16 +181,35 @@ class NativePipeline extends Pipeline {
AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
- try {
- if (useAppletLauncher) {
+ boolean loaded = false;
+ if (useAppletLauncher) {
+ try {
Class jnlpAppletLauncherClass = Class.forName("org.jdesktop.applet.util.JNLPAppletLauncher");
Method loadLibraryMethod = jnlpAppletLauncherClass.getDeclaredMethod("loadLibrary", String.class);
loadLibraryMethod.invoke(null, libName);
- } else {
- System.loadLibrary(libName);
+ loaded = true;
+ } catch (ClassNotFoundException ex) {
+ System.err.println("Java 3D: loadLibrary(" + libName + ")");
+ System.err.println(ex);
+ System.err.println("Attempting to use System.loadLibrary instead");
+ } catch (Exception ex) {
+ Throwable t = ex;
+ 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(ex);
}
- } catch (Exception ex) {
- throw new RuntimeException(ex);
+ }
+
+ if (!loaded) {
+ System.loadLibrary(libName);
}
return null;
}