
apploader.lib.AppClassLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apploader-lib Show documentation
Show all versions of apploader-lib Show documentation
Framework for delivering desktop application updates
The newest version!
package apploader.lib;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.List;
public final class AppClassLoader extends URLClassLoader {
private final HashMap dllMap = new HashMap<>();
public AppClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}
public void addJar(URL url) {
addURL(url);
}
public void addDLL(File file) {
dllMap.put(file.getName().toUpperCase(), file);
}
protected String findLibrary(String libname) {
File file = dllMap.get(libname.toUpperCase());
if (file == null) {
file = dllMap.get(System.mapLibraryName(libname).toUpperCase());
}
if (file == null)
return null;
return file.getAbsolutePath();
}
public void update(List jarList, List dllList) throws Exception {
for (File file : jarList) {
addJar(file.toURI().toURL());
}
for (File file : dllList) {
addDLL(file);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy