Friday, September 4, 2009

search for class file in JAR files

Searching for a Java class file in multiple JAR files is easy using this SearchInJar.jar tool.
Pass in the name of the class to find and the directory to search in, like this:

D:\searchinjar>java -jar SearchInJAR.jar oracle.jbo.domain.Number D:\oracle\jdevstudio111110-mw
found oracle/jbo/domain/Number.class in D:\oracle\jdevstudio111110-mw\jdeveloper\modules\oracle.adf.model.generic_11.1.1\bc4jdomgnrc.jar
found oracle/jbo/domain/Number.class in D:\oracle\jdevstudio111110-mw\jdeveloper\modules\oracle.adf.model_11.1.1\adfm.jar

Note that the SearchInJar.jar file includes the Java source files for this tool.