static { boolean tmpIsPure = false; if (Boolean.getBoolean(PURE_MODE_PROPERTY)) { if (debug) { System.out.println("property " + PURE_MODE_PROPERTY + " is true"); } tmpIsPure = true; } else { tmpIsPure = false; try { // Attempting to load the library SharedLibrary.loadLibrary(debug); } catch (UnsatisfiedLinkError ignore) { if (debug) { System.out.println( "java.library.path is set to:\n" + System.getProperty("java.library.path")); System.out.println("Error: Failed to load library " + SharedLibrary.getName()); ignore.printStackTrace(); } tmpIsPure = true; } } isPure = tmpIsPure; is64Bit = SharedLibrary.is64Bit(); String osName = System.getProperty("os.name", "unknown"); osStatsAreAvailable = osName.startsWith("Linux") || !isPure; }
static { try { System.loadLibrary("effectfisheye"); } catch (UnsatisfiedLinkError unsatisfiedlinkerror) { unsatisfiedlinkerror.printStackTrace(); } }
@Override public void removeElements() { try { N_RemoveElements(); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } }
// Load the native library static { try { System.loadLibrary("LibSVMTest"); status = modelInitialize("/Users/roygao/Downloads/libsvm1.model"); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } }
@Override public void getElements(Vector<CefPostDataElement> elements) { try { N_GetElements(elements); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } }
@Override public boolean addElement(CefPostDataElement element) { try { return N_AddElement(element); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } return false; }
@Override public int getElementCount() { try { return N_GetElementCount(); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } return 0; }
@Override public boolean isReadOnly() { try { return N_IsReadOnly(); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } return false; }
static { try { System.loadLibrary("qfs_access"); } catch (UnsatisfiedLinkError e) { e.printStackTrace(); System.err.println("Unable to load qfs_access native library"); System.exit(1); } }
/** * Attempt to make errors generated when 3D not available a little nicer. {@inheritDoc} * * @see java.awt.Component#addNotify() */ @Override public void addNotify() { try { super.addNotify(); } catch (UnsatisfiedLinkError ex) { LogContext.getLogger() .warning("Sorry, 3D model rendering has not been enabled " + "for this platform."); ex.printStackTrace(); } }
@Override protected void finalize() throws Throwable { try { N_CefPostData_DTOR(); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } finally { super.finalize(); } }
public static final CefPostData createNative() { CefPostData_N result = new CefPostData_N(); try { result.N_CefPostData_CTOR(); } catch (UnsatisfiedLinkError ule) { ule.printStackTrace(); } if (result.N_CefHandle == 0) return null; return result; }
static { try { System.loadLibrary("OpenCVEngine"); System.loadLibrary("OpenCVEngine_jni"); mIsReady = true; } catch (UnsatisfiedLinkError e) { mIsReady = false; e.printStackTrace(); } }
static { try { System.loadLibrary("kfs_access"); } catch (UnsatisfiedLinkError e) { e.printStackTrace(); System.err.println( "Unable to load kfs_access native library: " + System.getProperty("java.library.path")); System.exit(1); } }
private static synchronized void loadNativeLibrary() { String fullname = System.mapLibraryName("hello"); String suffix = fullname.substring(fullname.lastIndexOf('.')); if (suffix.equalsIgnoreCase(".jnilib")) suffix = ".dylib"; String libname = "libxml2j" + suffix; File targetLibrary = null; File localXcodeLibrary = new File( "/Users/rath/Library/Developer/Xcode/DerivedData/libxml2-java-fkrlovtvxnmqhfhhoxmlslcqmtjx/Build/Products/Debug/" + libname); if (localXcodeLibrary.exists() && localXcodeLibrary.lastModified() + (1000L * 60L * 30L) > System.currentTimeMillis()) { targetLibrary = localXcodeLibrary; System.out.println("*****************************************"); System.out.println("* Using libxml2j.dylib built on Xcode 5 *"); System.out.println("*****************************************"); } File localLibrary = new File("src/main/c/" + libname); if (targetLibrary == null && localLibrary.exists()) { targetLibrary = localLibrary; } if (targetLibrary == null) { String bundleLibname = Utils.getPlatformDependentBundleName(); targetLibrary = new File(System.getProperty("java.io.tmpdir"), bundleLibname); try { Utils.copyAndClose(LibXml.class.getResourceAsStream("/" + bundleLibname), targetLibrary); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } try { System.load(targetLibrary.getAbsolutePath()); } catch (UnsatisfiedLinkError e) { e.printStackTrace(); System.err.println("=============================================="); System.err.println(" We can't find libxml2 on your system "); System.err.println(" centos $ sudo yum install libxml2-devel "); System.err.println(" ubuntu $ sudo apt-get install libxml2-dev "); System.err.println(" macosx $ sudo port install libxml2 "); System.err.println("=============================================="); System.exit(1); } initInternalParser(); }
// Load video dll static { try { if (!ini) { System.loadLibrary("libs/dsj"); System.out.println("Video DLL loaded correctly"); // La siguiente linea comentada devuelve el número de bits del SO // System.out.println(System.getProperty("sun.arch.data.model")); ini = true; } } catch (UnsatisfiedLinkError e) { e.printStackTrace(); System.out.println("Video DLL not loaded"); } }
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); } }
public static String load(String libname, String mode) { try { String lib = "retin_" + libname + "-" + getArchName() + "-" + getCCName() + "-" + mode; // System.out.println ("Library "+lib+" try..."); System.loadLibrary(lib); System.out.println("Library " + lib + " loaded"); } catch (Exception ex) { return ex.getMessage(); } catch (UnsatisfiedLinkError ex) { ex.printStackTrace(); return ex.getMessage(); } return null; }
/** * Loads the SWIG-generated libSBML Java module when this class is loaded, or reports a sensible * diagnostic message about why it failed. */ static { String varname; String shlibname; if (System.getProperty("os.name").startsWith("Mac OS")) { varname = "DYLD_LIBRARY_PATH"; // We're on a Mac. shlibname = "'libsbmlj.jnilib'"; } else { varname = "LD_LIBRARY_PATH"; // We're not on a Mac. shlibname = "'libsbmlj.so' and/or 'libsbml.so'"; } try { System.loadLibrary("sbmlj"); // For extra safety, check that the jar file is in the classpath. Class.forName("org.sbml.libsbml.libsbml"); } catch (UnsatisfiedLinkError e) { System.err.println("Error encountered while attempting to load libSBML:"); e.printStackTrace(); System.err.println( "Please check the value of your " + varname + " environment variable and/or" + " your 'java.library.path' system property" + " (depending on which one you are using) to" + " make sure it list the directories needed to" + " find the " + shlibname + " library file and the" + " libraries it depends upon (e.g., the XML parser)."); System.exit(1); } catch (ClassNotFoundException e) { System.err.println( "Error: unable to load the file 'libsbmlj.jar'." + " It is likely that your -classpath command line " + " setting or your CLASSPATH environment variable " + " do not include the file 'libsbmlj.jar'."); System.exit(1); } catch (SecurityException e) { System.err.println("Error encountered while attempting to load libSBML:"); e.printStackTrace(); System.err.println( "Could not load the libSBML library files due to a" + " security exception.\n"); System.exit(1); } }
public static void loadDclassSharedObject() throws IOException { try { if (OS.contains("mac")) { System.load("/usr/local/lib/libdclassjni.0.dylib"); } else if (OS.contains("nix") || OS.contains("nux") || OS.contains("aix")) { System.load("/usr/lib/libdclassjni.so"); } else { System.err.println("OS not supported."); System.exit(-1); } } catch (UnsatisfiedLinkError e) { File f = new File("/usr/lib/libdclassjni.so"); System.err.println("/usr/lib/libdclassjni.so exists: " + f.exists()); System.err.println("/usr/lib/libdclassjni.so is readable: " + f.canRead()); System.err.println("Native code library failed to load.\n" + e); e.printStackTrace(); } }
/** * Loads the SWIG-generated libSBML Java module when this class is loaded, or reports a sensible * diagnostic message about why it failed. */ static { String varname; String shlibname; if (System.getProperty("mrj.version") != null) { varname = "DYLD_LIBRARY_PATH"; // We're on a Mac. shlibname = "libsbmlj.jnilib and/or libsbml.dylib"; } else { varname = "LD_LIBRARY_PATH"; // We're not on a Mac. shlibname = "libsbmlj.so and/or libsbml.so"; } try { System.loadLibrary("sbmlj"); // For extra safety, check that the jar file is in the classpath. Class.forName("org.sbml.libsbml.libsbml"); } catch (SecurityException e) { e.printStackTrace(); System.err.println( "Could not load the libSBML library files due to a" + " security exception.\n"); System.exit(1); } catch (UnsatisfiedLinkError e) { e.printStackTrace(); System.err.println( "Error: could not link with the libSBML library files." + " It is likely\nyour " + varname + " environment variable does not include the directories\n" + "containing the " + shlibname + " library files.\n"); System.exit(1); } catch (ClassNotFoundException e) { e.printStackTrace(); System.err.println( "Error: unable to load the file libsbmlj.jar." + " It is likely\nyour -classpath option and CLASSPATH" + " environment variable\n" + "do not include the path to libsbmlj.jar.\n"); System.exit(1); } }
public static void main(String[] args) { try { System.setProperty("sun.java2d.noddraw", "true"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } JFrame f = new JFrame("Balloon Test"); final String BALLOON_TEXT = "<html><center>" + "This is some sample balloon text<br>" + "which has been formatted with html.<br>" + "Click to dismiss.</center></html>"; final JLabel content = new JLabel(BALLOON_TEXT); content.setIconTextGap(10); content.setBorder(new EmptyBorder(0, 8, 0, 8)); content.setSize(content.getPreferredSize()); content.setIcon(new InfoIcon()); JLabel label = new JLabel("Click anywhere for more information"); label.setHorizontalAlignment(SwingConstants.CENTER); label.addMouseListener( new MouseAdapter() { private MouseListener listener = new MouseAdapter() { public void mousePressed(MouseEvent e) { hidePopup(e); } }; private Popup popup; private void hidePopup(MouseEvent e) { e.getComponent().removeMouseListener(listener); if (popup != null) popup.hide(); } public void mousePressed(MouseEvent e) { hidePopup(e); popup = BalloonManager.getBalloon(e.getComponent(), content, e.getX(), e.getY()); popup.show(); content.getParent().addMouseListener(listener); } }); f.getContentPane().add(label); f.pack(); f.setSize(new Dimension(300, 300)); f.setLocation(100, 100); try { // Force a load of JNA WindowUtils.setWindowMask(f, WindowUtils.MASK_NONE); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } catch (UnsatisfiedLinkError e) { e.printStackTrace(); String msg = e.getMessage() + "\nError loading the JNA library"; JTextArea area = new JTextArea(msg); area.setOpaque(false); area.setFont(UIManager.getFont("Label.font")); area.setEditable(false); area.setColumns(80); area.setRows(8); area.setWrapStyleWord(true); area.setLineWrap(true); JOptionPane.showMessageDialog( null, new JScrollPane(area), "Library Load Error: " + System.getProperty("os.name") + "/" + System.getProperty("os.arch"), JOptionPane.ERROR_MESSAGE); System.exit(1); } }