/** * Load a native library using a system-independent "short name" for the library. It will be * transformed to a correct filename in a system-dependent manner (for example, in Windows, * "mylib" will be turned into "mylib.dll"). This is done as follows: if the context that called * load has a ClassLoader cl, then <code>cl.findLibrary(libpath)</code> is used to convert the * name. If that result was null, or there was no class loader, this searches each directory of * the system property <code>java.library.path</code> for a file named <code> * System.mapLibraryName(libname)</code>. There may be a security check, of <code>checkLink</code> * . * * @param libname the library to load * @throws SecurityException if permission is denied * @throws UnsatisfiedLinkError if the library is not found * @see System#mapLibraryName(String) * @see ClassLoader#findLibrary(String) */ public void loadLibrary(String libname) { // This is different from the Classpath implementation, but I // believe it is more correct. SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkLink(libname); _load(libname, true); }
/** * Load a native library using the system-dependent filename. This is similar to loadLibrary, * except the only name mangling done is inserting "_g" before the final ".so" if the VM was * invoked by the name "java_g". There may be a security check, of <code>checkLink</code>. * * @param filename the file to load * @throws SecurityException if permission is denied * @throws UnsatisfiedLinkError if the library is not found */ public void load(String filename) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkLink(filename); _load(filename, false); }