advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Download the code for this article
What sort of classloading or class conflict issues have you encountered? How have you remedied the situation?
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
Average Rating: 3/5 | Rate this item | 1 user has rated this item.
 

Put an End to Jar File and Class Name Conflicts

Uncover hard-to-find class name conflicts and jar file version discrepancies and redundancies with a simple audit utility. 


advertisement
s the number of libraries and APIs proliferate, the number of jar files on a developer's system and on application servers increases exponentially. If you don't manage your system classpath and any additional classes or jar files that your application loads at runtime, insidious, hard-to-identify bugs may arise. Jar files that have the same name but contain different packaging, or identically named classes that contain methods with different signatures can leave you wondering why an application that once worked suddenly fails.


Knowing what's on your system's classpath and understanding Java's classloading mechanism are essential to building reliable applications. Although you could use the Java command line jar utility to display the contents of any of your jar files, typing the command jar tvf [filename] on each and every jar file on your system would be an extremely tedious and error-prone process. This article provides a simple, more efficient utility that enables you to inventory jar files and identify duplicates of both the jar files themselves and the classes packaged within them.

This tutorial discusses how to use this utility, or "auditor" as I refer to it, which you run from the command line. It displays results in a GUI interface (as shown in Figure 1), or saves results as an XML file (as shown in Internet Explorer in Figure 2).

Figure 1: Jar Auditor GUI Display

Figure 2: Jar Auditor XML Output
  Next Page: Undetected Redundancy in Jar Files


Page 1: IntroductionPage 3: Don't Assume. Audit!
Page 2: Undetected Redundancy in Jar FilesPage 4: End Class Name Conflicts
Please rate this item (5=best)
 1  2  3  4  5
advertisement