classpathhelper is a good start.
it automatically identifies orphan jars and much more.
the only limitation is with dependencies that are not defined in classes, e.g. in dependency injection framework configuration files.
you also have other options/complements, such as:
- workingfrog "relief", which relies on the ability to deal with real objects by examining their shape, size or relative place in space it gives a "physical" view on java packages, types and fields and their relationships, making them easier to handle.
- unnecessary code detector: a eclipse plugin tool to find unnecessary (dead) public java code.
i know this is an old one, but if anyone else stumbles upon this, eclipse does this by itself.
navigate to project properties->java code style->clean up select the eclipse [built-in] and it does the following:
- change non static accesses to static members using declaring type
- change indirect accesses to static members to direct accesses (accesses through subtypes)
- remove unused imports
- add missing '@override' annotations
- add missing '@override' annotations to implementations of interface methods
- add missing '@deprecated' annotations
- remove unnecessary casts
- remove unnecessary '$non-nls$' tags
in the maven and gradle projects you can use those plugins to identify unused dependencies.
- for maven : link
use this in the pom.xml file plugin.
- for gradle : link
use this in the build.gradle file plugin.
id "ca.cutterslade.analyze" version "1.7.1"
using legacy plugin application:
i found a very fast and interesting tool to archive this goal:
just unzip the program and run:
java -xmx512m -jar tattletale.jar ~/myjavaproject/mydistribution output
this will generate a very impressive report with different points (text from their site):
- identify dependencies between jar files
- find missing classes from the classpath
- spot if a class/package is located in multiple jar files
- spot if the same jar file is located in multiple locations
- with a list of what each jar file requires and provides
- verify the serialversionuid of a class
- find similar jar files that have different version numbers
- find jar files without a version number
- find unused jar archives
- identify sealed / signed jar archives
- locate a class in a jar file
- get the osgi status of your project
- remove black listed api usage
- and generate the same reports for your .war and .ear archives
ucdetector does not help for this : it does not work on jars. and for classpathhelper, i wan't able to find out an easy way just to list the orphan jars (btw, if someone has a tutorial for this, i am interested).
so, if you are also using maven as i do, i find out this great maven plugin, and i would like to share this solution with you. just type :
and you will instantly get a list of unused jars in your dependencies. very handy !
- Finding unused jars used in an eclipse project
- How to find out which versions of JARs were used in the eclipse project
- Print to file used jars in an eclipse maven project
- Finding out where a file in the project explorer is used in the code in Eclipse IDE
- Find unused classes in a Java Eclipse project
- Finding number of errors in an eclipse project
- changing the order of jars in eclipse project
- Multiple languages used in one eclipse project
- Finding the Eclipse Project file location
- How to refresh external Jars in Eclipse project (Java)?
- Android / Eclipse - finding unused files (Java/XML)
- Eclipse plugin to SonarQube 4.0 not finding provisioned project or creating new project
- Create Multiple JARs from Eclipse Project
- How to include the jars referenced in "Java Build Path" section of an Eclipse project in a jar file generated with Ant using a build.xml file
- Android Eclipse test projects cannot be used with a project being built in an Android build tree
- Project in Eclipse that builds a jar used by another project in Eclipse
- Attaching external JARs to a java project in eclipse - java.lang.NoClassDefFoundError
- adding external jars with bundles to project only in Eclipse
- How can I check in an Eclipse project unused libraries dependencies?
- Android project becomes terribly slow after adding HtmlUnit JARs to eclipse buildpath
- Export Java project from Eclipse as JAR with additional referenced jars
- Jenkins cannot find the external Jars added for the selenium project through Eclipse
- Running external jars using Eclipse Java project in cmd
- Eclipse 3.2.2 content assist not finding classes in the project
- Is there any plugin or feature that determines which JARs are unused in an application or a project (in a given project life cycle)
- Finding number of errors in an eclipse project using compilation unit
- Eclipse doesn't import all Axis2 jars but project still runs on Tomcat?
- How to use the eclipse Jar-in-Jar Classloader in a non-eclipse project to load jars at runtime?
- Local Java Project jars aren't added to Maven built war - Eclipse 3.6 Helios
- Project in eclipse not resolving jars present in Maven dependency
More Query from same tag
- Failed to get the adb version... No such file or directory
- What is the most elegant solution to managing various Java external libraries?
- file encoding issues with eclipse pydev
- android eclipse projects in package explorer disappears
- Importing multiple git repositories into one project in Intellij
- Maven keeps messing up my java compiler and build path settings
- How to keep line-break in array value of Annotation
- adt bundle eclipse not working
- M2Eclipse (M2E) build errors
- How to Convert ImageView to File imageFile
- Activity Lifecycle when AVD is stopped in Eclipse
- Eclipse SWT browser and Firebug lite?
- How to download eclipse marketplace plugins for offline install
- Problem with downloading F4 IDE (Mac IOS)
- Android WebView how to go to url
- Change Font Colors and Style for TeXlipse Only in Eclipse
- How to debug node / express?
- Displaying restart dialog
- Integrate Ant builder into Eclipse: Error "Variable references empty selection"
- Running multiple Adempiere instance on a single server
- Powershell outputting malformed filenames
- Eclipse Crash on Launch - JVM terminated. Exit code=2
- Access Popup menu in eclipse created with Menu(Control parent) constructor
- Eclipse won't recognize my device
- Eclipse warning: "problems during content assist"
- Trouble when importing a maven project into eclipse kepler (swagger for jersey rest)
- How to add project
- Flask code raises UnicodeDecodeError (only) when ran from outside Eclipse
- onActivityResult works!! but i can't debug
- Maven: 'Package does not exist' (and other errors)