Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm looking for a Windows script/batch file that will search a specified directory and subdirs (or possibly use the CLASSPATH?) for jar files, then search in those jars for a specified class.

It'd be best if it didn't need another package to run, but if you need to use cygwin, that's acceptable.

I've had to do this by hand before (exploding the jars, etc.), and it's not very fun.

share|improve this question
Did you check stackoverflow.com/questions/346811/…? –  nik Jun 15 '09 at 17:01
Thanks... that's similar. –  Bill James Jun 16 '09 at 19:40
add comment

3 Answers 3

up vote 1 down vote accepted

Jar Browser does this nicely, and has the added benefit of being written in Java, so you can use it anywhere.

share|improve this answer
Yes, this should do nicely. I wasn't even looking for a UI, but using one isn't out of the question. –  Bill James Jun 16 '09 at 19:41
add comment

JAR files use the ZIP format. That should make it a lot easier to automate, if you didn't already know it.

share|improve this answer
Yes, thanks... I did. –  Bill James Jun 16 '09 at 19:40
add comment

You can browse through jar/zip files in powershell using DotNetZip.

$SourceFile = "c:\files\filename.jar" 
$zipfile = [Ionic.Zip.ZipFile]::Read($sourceFile) 
foreach($file in $zipfile) 

All you would have to do is iterate through the classpath or whatever set of JARs you want to search for.

DotNetZip is free.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.