]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - vtk/src/vtk/vtkJavaDep.java
Loading VTK dlls with plug-in activator.
[simantics/3d.git] / vtk / src / vtk / vtkJavaDep.java
index c482235a307ae3bb561359f7ba29380b195ea7f0..0377199e106ffde0ed74802a5f147a5d45d9f936 100644 (file)
@@ -8,7 +8,6 @@ package vtk;
  */
 public class vtkJavaDep {
          static String[] libs = new String[] {
-                         "jawt",
                          "vtksys",
                          "vtkCommonCore",
                      "vtkWrappingJava",
@@ -121,20 +120,28 @@ public class vtkJavaDep {
                      "vtkIOImportJava",
 
                      };
+       
+       private static boolean loaded = false;
 
+    static void load() {
+        if (!loaded) {
 
-       static {
-               try {
-                       Class.forName("java.awt.Toolkit");
-               } catch (ClassNotFoundException e) {
-                       throw new IllegalStateException(e);
-               }
+            try {
+                Class.forName("java.awt.Toolkit");
+            } catch (ClassNotFoundException e) {
+                throw new IllegalStateException(e);
+            }
+            try {
+                System.loadLibrary("jawt");
+            } catch (UnsatisfiedLinkError e) {
+                // bypass potential load error. If jawt is not really loaded, we will get errors
+                // with VTK dlls.
+            }
 
-               for (String lib : libs)
-                       System.loadLibrary(lib);
-       }
-
-       static void load() {
+            for (String lib : libs)
+                System.loadLibrary(lib);
 
+            loaded = true;
+           }
        }
 }