/** Opens the given native library, assuming it has the same base name on all platforms, looking first in the system's search path, and in the context of the specified ClassLoader, which is used to help find the library in the case of e.g. Java Web Start. */ public static final NativeLibrary open(final String libName, final ClassLoader loader) { return open(libName, libName, libName, true, loader, true); }
/** Opens the given native library, assuming it has the same base name on all platforms, looking first in the system's search path, and in the context of the specified ClassLoader, which is used to help find the library in the case of e.g. Java Web Start. */ public static final NativeLibrary open(final String libName, final ClassLoader loader, final boolean global) { return open(libName, libName, libName, true, loader, global); }
protected final NativeLibrary loadFirstAvailable(final List<String> libNames, final ClassLoader loader, final boolean global) { for (int i=0; i < libNames.size(); i++) { final NativeLibrary lib = NativeLibrary.open(libNames.get(i), loader, global); if (lib != null) { return lib; } } return null; }
public static final NativeLibrary open(final String windowsLibName, final String unixLibName, final String macOSXLibName, final boolean searchSystemPathFirst, final ClassLoader loader, final boolean global) { final List<String> possiblePaths = enumerateLibraryPaths(windowsLibName, unixLibName, macOSXLibName, searchSystemPathFirst, loader); Platform.initSingleton(); // loads native gluegen-rt library // Iterate down these and see which one if any we can actually find. for (final Iterator<String> iter = possiblePaths.iterator(); iter.hasNext(); ) { final String path = iter.next(); if (DEBUG) { System.err.println("NativeLibrary.open(global "+global+"): Trying to load " + path); } long res; Throwable t = null; try { if(global) { res = dynLink.openLibraryGlobal(path, DEBUG); } else { res = dynLink.openLibraryLocal(path, DEBUG); } } catch (final Throwable t1) { t = t1; res = 0; } if ( 0 != res ) {