Skip to content

Library for loading jar dependencies at runtime

License

Notifications You must be signed in to change notification settings

Exlll/JarLoader

Repository files navigation

Usage

1. Define a dependency

JarDependency dependency = new JarDependency(
        "http://repo.exlll.de/configlib-core-2.2.0.jar",
        Paths.get("dependency.jar")
).addDigest("MD5", "4f8245a58ac12c735d0b1f9ca42a0abe")
 .addDigest("SHA-256", "6b598e77d1671...111373f9bcd10d");

2. Download the jar

JarLoader.download(dependency);
// or
JarLoader.downloadIfNotExists(dependency);

3. Load the jar

If the downloaded file is a Bukkit plugin, you can load it using:

Bukkit.getPluginManager().loadPlugin(...)

If the file is a library and not a Bukkit plugin, use the ClassLoader of your own plugin:

URLClassLoader loader = (URLClassLoader) plugin.getClassLoader();
JarLoader.load(dependency, loader);

About

Library for loading jar dependencies at runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages