What is a fat JAR? [duplicate]

The fat jar is the jar, which contains classes from all the libraries, on which your project depends and, of course, the classes of current project. In different build systems fat jar is created differently, for example, in Gradle one would create it with (instruction): task fatJar(type: Jar) { manifest { attributes ‘Main-Class’: ‘com.example.Main’ } … Read more

How to load a jar file at runtime [duplicate]

Reloading existing classes with existing data is likely to break things. You can load new code into new class loaders relatively easily: ClassLoader loader = URLClassLoader.newInstance( new URL[] { yourURL }, getClass().getClassLoader() ); Class<?> clazz = Class.forName(“mypackage.MyClass”, true, loader); Class<? extends Runnable> runClass = clazz.asSubclass(Runnable.class); // Avoid Class.newInstance, for it is evil. Constructor<? extends Runnable> … Read more

“Invalid signature file” when attempting to run a .jar

For those who got this error when trying to create a shaded uber-jar with maven-shade-plugin, the solution is to exclude manifest signature files by adding the following lines to the plugin configuration: <configuration> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> <!– Additional configuration. –> </configuration>