User Tools

Site Tools


java:searchinsideajarfile

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
java:searchinsideajarfile [2012/08/22 14:10] – [Other option] rlunarojava:searchinsideajarfile [2022/12/02 22:02] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== How to search inside a Jar file ======
 +
 +===== Intro =====
 +
 +Sometimes it is useful to detect if a certain class is inside a jar file without the tedious process of rename it to .zip, uncompress and make a search. 
 +
 +It is possible to instruct windows to do the search inside a jar file with a simple change in the registry. 
 +
 +Here are the instructions: 
 +
 +http://stackoverflow.com/questions/878769/how-to-search-jar-files-using-windows-search
 +
 +And, for the sake of not loosing the key data, here are the registry key that must be created. This is the dump of a registry file, so if you just create file called "something.reg" with this data, and double click on it, the information will be incorporated to your registry file and voilá!! search inside a jar is implemented. 
 +
 +**You have to re-login to the computer for make this to work.**
 +
 +
 +<code registry>
 +Windows Registry Editor Version 5.00
 +
 +[HKEY_CLASSES_ROOT\.jar\PersistentHandler]
 +@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
 +</code>
 +
 +===== Other option =====
 +
 +I've tried the first one and it didn't work, but this one, despite being a command line tool, works very fine:
 +
 +http://www.inetfeedback.com/jarscan/
 +
 +I've created a batch file for run it more easily (see below). I've changed the name to grepjar because I am more accustomed to this sintax. 
 +
 +<code bat>
 +@echo off
 +
 +rem grepjar.bat - wrapper for jarscan.jar file
 +
 +set "bindir=%~dp0%"
 +
 +if "%*" == "" goto help
 +
 +java -jar "%bindir%jarscan.jar" -dir "%1" -class "%2" 
 +
 +goto exit
 +
 +:help
 +
 +echo Usage: grepjar directory class-to-search
 +
 +:exit
 +
 +</code>
 +
 +
 +
 +~~DISQUS~~
 +
 +
 +