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 years 34 weeks ago
4 years 3 weeks ago
4 years 3 weeks ago
4 years 5 weeks ago
4 years 6 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 14 weeks ago