How to decompile a whole Jar file? [closed]

2022 update: QuiltMC/quiltflower is the latest most advanced Java decompiler: Quiltflower is a modern, general purpose decompiler focused on improving code quality, speed, and usability. Quiltflower is a fork of Fernflower and Forgeflower. Changes include: New language features (Try with resources, switch expressions, pattern matching, and more) Better control flow generation (loops, try-catch, and switch, … Read more

What is the maven-shade-plugin used for, and why would you want to relocate Java packages?

Uber JAR, in short, is a JAR containing everything. Normally in Maven, we rely on dependency management. An artifact contains only the classes/resources of itself. Maven will be responsible to find out all artifacts (JARs etc) that the project depending on when the project is built. An uber-jar is something that takes all dependencies, and … Read more

How to import a jar in Eclipse?

You can add a jar in Eclipse by right-clicking on the Project → Build Path → Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar. A quick demo here. The above solution is obviously a “Quick” one. However, if you are working on a project where you … Read more

How to load JAR files dynamically at Runtime?

The reason it’s hard is security. Classloaders are meant to be immutable; you shouldn’t be able to willy-nilly add classes to it at runtime. I’m actually very surprised that works with the system classloader. Here’s how you do it making your own child classloader: URLClassLoader child = new URLClassLoader( new URL[] {myJar.toURI().toURL()}, this.getClass().getClassLoader() ); Class … Read more

Including dependencies in a jar with Maven

You can do this using the maven-assembly plugin with the “jar-with-dependencies” descriptor. Here’s the relevant chunk from one of our pom.xml’s that does this: <build> <plugins> <!– any other plugins –> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build>

“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>

Difference between jar and war in Java

From Java Tips: Difference between ear jar and war files: These files are simply zipped files using the java jar tool. These files are created for different purposes. Here is the description of these files: .jar files: The .jar files contain libraries, resources and accessories files like property files. .war files: The war file contains … Read more

How to build jars from IntelliJ properly?

Here’s how to build a jar with IntelliJ 10 http://blogs.jetbrains.com/idea/2010/08/quickly-create-jar-artifact/ File -> Project Structure -> Project Settings -> Artifacts -> Click green plus sign -> Jar -> From modules with dependencies… Select a Main Class (the one with main() method) if you need to make the jar runnable. The above sets the “skeleton” to where … Read more

Can’t execute jar- file: “no main manifest attribute”

First, it’s kind of weird, to see you run java -jar “app” and not java -jar app.jar Second, to make a jar executable… you need to jar a file called META-INF/MANIFEST.MF the file itself should have (at least) this one liner: Main-Class: com.mypackage.MyClass Where com.mypackage.MyClass is the class holding the public static void main(String[] args) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)