Sunday 4 August 2019

windows 7 - Finding which jars contain a file


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

Answer



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.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...