Finding which jars contain a file

8,015

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:
8,015

Related videos on Youtube

Cincinnati Joe
Author by

Cincinnati Joe

Updated on September 18, 2022

Comments

  • Cincinnati Joe
    Cincinnati Joe over 1 year

    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
    
  • Cincinnati Joe
    Cincinnati Joe almost 13 years
    Interesting, I'll try that. How about .war and .ear?
  • 100rabh
    100rabh almost 13 years
    Guess the same steps should hold good for wars & ears
  • Spectre
    Spectre almost 13 years
    Should be the same, provided both are just standard zip files with different extensions
  • Spectre
    Spectre almost 13 years
    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
    Spectre almost 13 years
    Also, is that ".rar" you said it worked on a WinRAR archive? Because it would be strange if Windows had builtin (but not enabled) support for WinRAR files...
  • Cincinnati Joe
    Cincinnati Joe almost 13 years
    Hmm...this seemed to work when I first added it last week. But it no longer appears to be working. I tried searching contents for files inside a jar and war in the current dir but it fails to find them. If I run the free Agent Ransack, they are found quickly. The reg entries are still there, I merged the .reg again, compared them to the zip entry. Not sure why this would have stopped working after a restart or something.
  • orbfish
    orbfish over 10 years
    Not working in Windows 7