While creating a Java web application you'll most probably use various libraries pre-packaged into JAR files. And of course you'll create several JARs for your own code as well. However some of these JARs might share the same classes and most of the time there's no guarantee on from which JAR a class is loaded. Your best bet is to make sure that each class (that you need) is present only in one JAR in you
lib folder. To find classes that occur more than once in a webapp library folder, I've written a short shellscript.
It's quite simple to use. You can supply pathes to library folders as arguments. The script searches for *.jar files in the given directories and reports each class that was already found previously during the processing. The script uses the
jar and
gawk commands and has been tested on Ubuntu 8.10 with the
sun-java6-jdk (6-10-0ubuntu2) and
gawk (1:3.1.6.dfsg-0ubuntu1) packages.
Example:
cd apache-tomcat-5.5.27
./find_duplicate_classes.sh common/lib server/lib webapps/MyWebApp/WEB-INF/lib
Recent comments
2 days 10 hours ago
1 week 5 days ago
1 week 6 days ago
1 week 6 days ago
2 weeks 9 hours ago
2 weeks 17 hours ago
2 weeks 4 days ago
2 weeks 4 days ago
4 weeks 2 days ago
4 weeks 2 days ago