What is the easiest way (tool ?) to remove unused jars from my java (ant ) project. Our project has become really huge, and we want to do a clean up. There are several jars that are added to the classpath, but not all are used for compile/run. Is there a way to identify the unnecessary jars by running some utility from command line?
Note: we do not want to follow the tedious process of removing one or more jars, then compile/run to test if those are required or not.
Select Project in Project Explorer and Press "Alt+Enter" then Go to Java Build path and select Libraries then select jar file finally click on Remove button. select jar in the Project tree-view and right click on it and select Build Path then in select the Remove from Build Path . You are done.
The most prominent JAR malware, that has been around since January 2013 is 'Adwind'. This RAT (Remote Access Trojan) takes advantage of JAR's cross-platform features, and can be executed on Windows, Mac OSX, Linux and since August 2013- Android OS.
If there's a better solution to this, I'd love to hear it.
The problem is that even if a jar isn't needed to compile, it could be needed to run. And this "need" could be transitive. EG: A jar you use needs a jar you don't use and only at runtime. As is the nature of runtime errors, they'll only reveal themselves when you try to execute the code. Worst case, that may not occur until you're running in production.
The best solution I know of is exactly what you don't want to do: "removing one or more jars, then compile/run to test if those are required or not".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With