find a jar file by the name of class

A utility to find the text from archives. This strain is specifically useful for finding the particular jar file if it contains the given class. Use it freely on any Unix and Linux platform.


 for f in `find $1 -name "*.jar"`  
 do  
   if [ `jar tf $f | grep "class" | sed 's|/|.|g' | grep $2 | wc -l` -gt 0 ] ; then  
    echo $f  
   fi  
 done  

Example usage:

$ ./jarFinder . com.ibm.ws.webservices.engine.description.OperationDesc

Output
./libs/Lib/com.ibm.ws.runtime.jar
./libs/Lib/com.ibm.ws.runtime.jar

Comments

Popular posts from this blog

Caused by: java.sql.SQLTimeoutException: ORA-01013: user requested cancel of current operation

pandas dataframe add missing date from range in a multi-dimensional structure with duplicate index

Delete horizontal, vertical and angled lines from an image using Python to clear noise and read text with minimum errors