/** * Returns the resource URL for the named library. * * @param name the library name * @return the library's resource URL, or <tt>null</tt> if it is not found */ @Override protected URL getResourcePath(String name) { if (name.startsWith("COIOSHelper")) { String resource = "/com/izforge/izpack/bin/native/3rdparty/" + name + ".dll"; return getClass().getResource(resource); } return super.getResourcePath(name); } }
/** * Add a NativeLibraryClient as dependant to this object. The method tries to load the shared * library COIOSHelper which should contain native methods for the dependant. * * @param dependant to be added * @throws UnsatisfiedLinkError if the library cannot be loaded */ public synchronized void addDependant(NativeLibraryClient dependant) { used++; librarian.loadLibrary("COIOSHelper", dependant); }
/** * Attempts to load a library from the <em>DLL_PATH</em> system property. * * @param name the library name * @param client the native library client * @return <tt>true</tt> if the library was loaded successfully, otherwise <tt>false</tt> */ private boolean loadFromDLLPath(String name, NativeLibraryClient client) { String property = System.getProperty("DLL_PATH"); if (property != null) { String path = property + "/" + name + extension; path = path.replace('/', File.separatorChar); return load(path, client); } return false; }
if (loadFromDLLPath(name, client) || loadSystemLibrary(name, client) || loadFromClassPath(name, client))
/** * Loads a library. * * @param name the library name * @param client the native library client * @throws UnsatisfiedLinkError if the library cannot be loaded */ public synchronized void loadLibrary(String name, NativeLibraryClient client) throws UnsatisfiedLinkError { name = strip(name); if (!trackList.contains(name)) { // no attempt has been made to load the library yet boolean loaded = loadArchSpecificLibrary(name, client); if (!loaded) { String name64 = name + "_x64"; loaded = loadArchSpecificLibrary(name64, client); } if (loaded) { trackList.add(name); } else { throw new UnsatisfiedLinkError("Failed to load library: " + name); } } }
URL url = getResourcePath(name); if (url != null) result = load(path, client); result = loadJarLibrary(name, url, client);
Platform platform = platforms.getCurrentPlatform(); TargetFactory factory = new TargetFactory(new DefaultTargetPlatformFactory(dummy, platform, platforms)); Librarian librarian = new Librarian(factory, new Housekeeper()); System.out.println("(Java) Opening new file queue..."); WinSetupFileQueue fq = new WinSetupFileQueue(librarian, new WinSetupDefaultCallbackHandler());
/** * Constructs a <tt>WinSetupAPIBase</tt>. * * @param librarian the librarian * @throws IzPackException if the WinSetupAPI library cannot be loaded */ public WinSetupAPIBase(Librarian librarian) { try { librarian.loadLibrary("WinSetupAPI", this); } catch (UnsatisfiedLinkError error) { throw new IzPackException("Failed to load WinSetupAPI", error); } }
result = load(path, client);
librarian.loadLibrary("ShellLink", this);