+ /* Statically load the library which contains all native functions used in here */
+ static private boolean isNativeInited = false;
+ public static void nativeInit() {
+ if (isNativeInited)
+ return;
+
+ if (System.getProperty("os.name").toLowerCase().startsWith("win"))
+ NativeLib.nativeInit("winpthread-1");
+
+ NativeLib.nativeInit("simgrid");
+ NativeLib.nativeInit("surf-java");
+ NativeLib.nativeInit("simgrid-java");
+ isNativeInited = true;
+ }
+
+ static {
+ nativeInit();
+ }
+
+
+ public static void nativeInit(String name) {
+ try {
+ /* Prefer the version of the library bundled into the jar file and use it */
+ loadLib(name);
+ } catch (SimGridLibNotFoundException e) {
+ /* If not found, try to see if we can find a version on disk */
+ try {
+ System.loadLibrary(name);
+ } catch (UnsatisfiedLinkError e2) {
+ System.err.println("Cannot load the bindings to the "+name+" library in path "+getPath());
+ e.printStackTrace();
+ System.err.println("This jar file does not seem to fit your system, and I cannot find an installation of SimGrid.");
+ System.exit(1);
+ }
+ }
+ }