示例#1
0
 public void initSystem() {
   Pointer[] p = new Pointer[1];
   try {
     int result = LibUsbLibrary.libUsb.libusb_init(p);
     checkError("init", result);
     this.context = p[0];
     // LibUsbLibrary.libUsb.libusb_set_debug(this.context, 4);
   } catch (UnsatisfiedLinkError e) {
     if (e.getMessage().matches(".*cannot open shared object file.*")) {
       System.out.println("Libusb not found. Minimum libusb version is 1.0.14");
       System.out.println("It can be downloaded on http://www.libusbx.org");
     } else {
       System.out.println(e.getLocalizedMessage());
     }
     System.exit(1);
   }
   try {
     libusb_version v = LibUsbLibrary.libUsb.libusb_get_version();
     if (v.major != (short) 1 || v.minor != (short) 0 || v.micro < (short) 14) {
       System.out.println(
           "Minimum libusb version is 1.0.14. Found " + v.major + "." + v.minor + "." + v.micro);
       System.out.println("It can be downloaded on http://www.libusbx.org");
       System.exit(1);
     }
   } catch (UnsatisfiedLinkError e) {
     System.out.println(
         "A libusb was found but not with the right version. Minimum libusb version is 1.0.14");
     System.out.println("It can be downloaded on http://www.libusbx.org");
     System.exit(1);
   }
 }
 static {
   try {
     System.loadLibrary("scilocalization");
   } catch (SecurityException e) {
     System.err.println(
         "A security manager exists and does not allow the loading of the specified dynamic library.");
     System.err.println(e.getLocalizedMessage());
     e.printStackTrace(System.err);
   } catch (UnsatisfiedLinkError e) {
     System.err.println("The native library scilocalization does not exist or cannot be found.");
     System.err.println(e.getLocalizedMessage());
     e.printStackTrace(System.err);
   }
 }
示例#3
0
 static {
   try {
     System.loadLibrary("scixcos");
   } catch (SecurityException e) {
     System.err.println(
         "A security manager exists and does not allow the loading of the specified dynamic library.");
     System.err.println(e.getLocalizedMessage());
     System.exit(-1);
   } catch (UnsatisfiedLinkError e) {
     System.err.println("The native library scicommons does not exist or cannot be found.");
     if (System.getenv("CONTINUE_ON_JNI_ERROR") == null) {
       System.err.println(e.getLocalizedMessage());
       System.err.println(
           "Current java.library.path is : " + System.getProperty("java.library.path"));
       System.exit(-1);
     } else {
       System.err.println("Continuing anyway because of CONTINUE_ON_JNI_ERROR");
     }
   }
 }