]> gerrit.simantics Code Review - simantics/python.git/blobdiff - org.simantics.pythonlink/src/org/simantics/pythonlink/Activator.java
Report and log failure of Python DLL loading
[simantics/python.git] / org.simantics.pythonlink / src / org / simantics / pythonlink / Activator.java
index 83633a4114c9282b0e86c65f06975681db66c6ae..26798d6f0b6fa53e33a0c4913bfd76195daa8be6 100644 (file)
@@ -2,11 +2,16 @@ package org.simantics.pythonlink;
 \r
 import org.osgi.framework.BundleActivator;\r
 import org.osgi.framework.BundleContext;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 public class Activator implements BundleActivator {\r
 \r
+       private static final Logger LOGGER = LoggerFactory.getLogger(Activator.class);\r
        private static BundleContext context;\r
 \r
+       private static boolean loaded = false;\r
+       \r
        static BundleContext getContext() {\r
                return context;\r
        }\r
@@ -17,7 +22,16 @@ public class Activator implements BundleActivator {
         */\r
        public void start(BundleContext bundleContext) throws Exception {\r
                Activator.context = bundleContext;\r
-        System.loadLibrary("jnipython");\r
+               try {\r
+                       System.loadLibrary("jnipython");\r
+                       loaded = true;\r
+               } catch (Exception e) {\r
+                       LOGGER.error("Loading of jnipython.dll failed", e);\r
+               }\r
+       }\r
+       \r
+       public static boolean isPythonLoaded() {\r
+               return loaded;\r
        }\r
 \r
        /*\r