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

HashiCorp Vault Integration with Ansible Etower using approle

utility to extract date from text with java