Below are the sample commands to find out required class is there in the jar files of current directory and its sub-dirs.
Unix :
find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep com/sun/net/ssl/HostnameVerifier.class && echo {}'
find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep HostnameVerifier.class && echo {}'
Ex :
[kg6378@bldv0014 jdk1.6.0_20]$ find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep com/sun/net/ssl/HostnameVerifier.class && echo {}'
com/sun/net/ssl/HostnameVerifier.class
./jre/lib/jsse.jar
[kg6378@bldv0014 jdk1.6.0_20]$ find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep HostnameVerifier.class && echo {}'
com/sun/deploy/security/CertificateHostnameVerifier.class
./jre/lib/deploy.jar
javax/net/ssl/HostnameVerifier.class
javax/net/ssl/HttpsURLConnection$DefaultHostnameVerifier.class
sun/net/www/protocol/https/DefaultHostnameVerifier.class
com/sun/net/ssl/HostnameVerifier.class
./jre/lib/jsse.jar
Windows :
forfiles /S /M *.jar /C "cmd /c jar -tvf @file | findstr /C:"HostnameVerifier.class" && echo @path"
C:\Users\kg6378\Desktop\jdk-7u79-windows-x64\tools>cd C:\Krish\MyDocs\SWS\Jdk1.6
.0_14
C:\Krish\MyDocs\SWS\Jdk1.6.0_14>forfiles /S /M *.jar /C "cmd /c jar -tvf @file |
findstr /C:"HostnameVerifier.class" && echo @path"
3517 Thu May 21 09:19:20 EDT 2009 com/sun/deploy/security/CertificateHostnameV
erifier.class
"C:\Krish\MyDocs\SWS\Jdk1.6.0_14\jre\lib\deploy.jar"
194 Thu Feb 05 13:54:20 EST 2009 javax/net/ssl/HostnameVerifier.class
618 Thu Feb 05 13:54:22 EST 2009 javax/net/ssl/HttpsURLConnection$DefaultHost
nameVerifier.class
384 Thu Feb 05 13:54:22 EST 2009 sun/net/www/protocol/https/DefaultHostnameVe
rifier.class
272 Thu Feb 05 13:54:32 EST 2009 com/sun/net/ssl/HostnameVerifier.class
"C:\Krish\MyDocs\SWS\Jdk1.6.0_14\jre\lib\jsse.jar"
C:\Krish\MyDocs\SWS\Jdk1.6.0_14>
Unix :
find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep com/sun/net/ssl/HostnameVerifier.class && echo {}'
find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep HostnameVerifier.class && echo {}'
Ex :
[kg6378@bldv0014 jdk1.6.0_20]$ find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep com/sun/net/ssl/HostnameVerifier.class && echo {}'
com/sun/net/ssl/HostnameVerifier.class
./jre/lib/jsse.jar
[kg6378@bldv0014 jdk1.6.0_20]$ find . -type f -name '*.jar' -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep HostnameVerifier.class && echo {}'
com/sun/deploy/security/CertificateHostnameVerifier.class
./jre/lib/deploy.jar
javax/net/ssl/HostnameVerifier.class
javax/net/ssl/HttpsURLConnection$DefaultHostnameVerifier.class
sun/net/www/protocol/https/DefaultHostnameVerifier.class
com/sun/net/ssl/HostnameVerifier.class
./jre/lib/jsse.jar
Windows :
forfiles /S /M *.jar /C "cmd /c jar -tvf @file | findstr /C:"HostnameVerifier.class" && echo @path"
C:\Users\kg6378\Desktop\jdk-7u79-windows-x64\tools>cd C:\Krish\MyDocs\SWS\Jdk1.6
.0_14
C:\Krish\MyDocs\SWS\Jdk1.6.0_14>forfiles /S /M *.jar /C "cmd /c jar -tvf @file |
findstr /C:"HostnameVerifier.class" && echo @path"
3517 Thu May 21 09:19:20 EDT 2009 com/sun/deploy/security/CertificateHostnameV
erifier.class
"C:\Krish\MyDocs\SWS\Jdk1.6.0_14\jre\lib\deploy.jar"
194 Thu Feb 05 13:54:20 EST 2009 javax/net/ssl/HostnameVerifier.class
618 Thu Feb 05 13:54:22 EST 2009 javax/net/ssl/HttpsURLConnection$DefaultHost
nameVerifier.class
384 Thu Feb 05 13:54:22 EST 2009 sun/net/www/protocol/https/DefaultHostnameVe
rifier.class
272 Thu Feb 05 13:54:32 EST 2009 com/sun/net/ssl/HostnameVerifier.class
"C:\Krish\MyDocs\SWS\Jdk1.6.0_14\jre\lib\jsse.jar"
C:\Krish\MyDocs\SWS\Jdk1.6.0_14>
Reactions: |
0 comments to "Unix command to find class in jar | windows command to search class in jars"
Tags
Powered by WidgetsForFree
My Blog List
Popular posts
- Airtel and vodafone GPRS settings for pocket PC phones
- Andhra 2 America
- Ayyappa Deeksha required things
- Blogs I watch !
- Captions for your bike
- DB2 FAQs
- Deepavali Vs The Goddes of sleep
- ETV - Dhee D2 D3
- Evolution of smoking in India Women
- How to make credit card payments?
- Java-J2EE interview preparation
- My SQL FAQs
- My Travelogues
- Old is blod - New is italic
- Online pay methids for credit cards
- Oracle FAQs
- Pilgrimages
- Smoking in Indian Women
- Technology Vs Humans
- Twitter feeds for all Telugu stars on single page.
- Unix FAQs
- Unix best practices
- init 0, init 1, init 2 ..
- mCheck Application jar or jad download

Post a Comment
Who ever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs u can at least use Name/URL option which don’t even require any sign-in, good thing is that it can accept your lovely nick name also and URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")
వీలయితే నాల్గు పోస్టులు ...కుదురితే ఒక కామెంటూ ...