Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

With Windows XP, I recall being able to using Windows Search to find which jars in a dir contain a specific class file. But on Windows 7, this no longer seems to work. I've got the Search option checked to "Include compressed files (ZIP, CAB, ...)" but that doesn't seem to help. Searching File Contents (which appears as a choice after the initial search fails) also doesn't seem to work.

I was able to find the file by using the following command, but that's a pain (have to open a command prompt in the desired dir, paste the updated command, and visually inspect the results which can be very long if there are many jars).

for %i in (*.jar) DO %JDKHOME%\bin\jar.exe tf %i | grep myfile
share|improve this question

1 Answer 1

up vote 4 down vote accepted

By default, Windows 7 doesn't think .jar is a zip file that it can open, so doesn't enumerate its contents. You can fix this with the following registry addition:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.jar\PersistentHandler]
@="{3B224B11-9363-407e-850F-C9E1FFACD8FB}"

Either paste that into a text file and save as fix.reg, then open it and agree to add it to the registry.

EDIT : The GUID is unique per machine. Instead:

Open registry editor, and Navigate to the key HKEY_CLASSES_ROOT\.zip\PersistentHandler and copy the value in (Default).

Then go to HKEY_CLASSES_ROOT\.jar, add a new key PersistentHandler, and paste the copied GUID into the (Default) value.

Then in explorer searching in jar files with work, using the search file contents option.

share|improve this answer
    
Interesting, I'll try that. How about .war and .ear? –  Cincinnati Joe May 19 '11 at 22:02
    
Guess the same steps should hold good for wars & ears –  Sathya May 20 '11 at 5:10
    
Should be the same, provided both are just standard zip files with different extensions –  Spectre May 20 '11 at 14:00
1  
This almost worked :) The GUID doesn't work on my Win7 machine. Neither does the GUID in the 2 yr-old StackOverflow question I then found:How to search Jar files using Windows Search? Another place online said to copy the entries from .zip, so I copied that GUID which worked for .jar, .war, .ear, .rar: [HKEY_CLASSES_ROOT\.jar\PersistentHandler] @="{098f2470-bae0-11cd-b579-08002b30bfeb}" –  Cincinnati Joe May 24 '11 at 17:06
    
I see. I guess that GUID must be randomly generated per install, which I find a bit odd, but yes, copying the GUID from the .zip entry is the correct thing to do (and what I did when I created my answer). Ill update my answer. –  Spectre May 24 '11 at 17:34

Your Answer

 
discard

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.