java: Added auto load library code to the SWIG interface file
authorStefan Andritoiu <stefan.andritoiu@intel.com>
Tue, 24 Nov 2015 15:03:12 +0000 (17:03 +0200)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Mon, 30 Nov 2015 09:57:58 +0000 (09:57 +0000)
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/java/mraajava.i

index 3618711..a97e90c 100644 (file)
@@ -66,3 +66,14 @@ class Spi;
         return JNI_VERSION_1_8;
     }
 %}
+
+%pragma(java) jniclasscode=%{
+    static {
+        try {
+            System.loadLibrary("mraajava");
+        } catch (UnsatisfiedLinkError e) {
+            System.err.println("Native code library failed to load. \n" + e);
+            System.exit(1);
+        }
+    }
+%}