Wednesday, July 16, 2008

Which JAR file ?

Class path issues are always painful and will waste lot of times from programmers. When you are working with big projects it makes things more & more cumbersome. In a Java project, how do we find out which JAR file contains the class files we are looking for? Most of the time programmers are will adopt bulldozer methodology to overcome this issue. Bulldozer methodology means programmer will copy all list of suspected JAR files in to the classpath instead of required libraries only. Obviously this will add unnecessary extra mega bytes of junk to your final release.

To find out which JAR file contains class file looking for, has to have good search utility in your operating system. If you are using Linux operating system 'grep' command is the ideal to overcome this issue. It is very fast and reliable tool carry out text searches against binary files.

Let's say we are looking for a JAR which contains class file called 'Contstants'.
grep Contants *.jar

No comments: