\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
*/\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
};
private static synchronized void ensurePythonInit() {
+ if (!Activator.isPythonLoaded()) {
+ throw new PythonException("Python interpreter has not been successfully loaded. Check availablility of python3.dll in path.");
+ }
+
if (!isPyInitialized) {
execute(() -> initializePython(pythonWriter));
isPyInitialized = true;