Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h1>Unix</h1> <p>Use the <code>jar</code> (or <code>unzip -v</code>), <code>grep</code>, and <code>find</code> commands.</p> <p>For example, the following will list all the class files that match a given name:</p> <pre><code>for i in *.jar; do jar -tvf "$i" | grep -Hsi ClassName &amp;&amp; echo "$i"; done </code></pre> <p>If you know the entire list of Java archives you want to search, you could place them all in the same directory using (symbolic) links.</p> <p>Or use <code>find</code> (case sensitively) to find the JAR file that contains a given class name:</p> <pre><code>find path/to/libs -name '*.jar' -exec grep -Hls ClassName {} \; </code></pre> <p>For example, to find the name of the archive containing <code>IdentityHashingStrategy</code>:</p> <pre><code>$ find . -name "*.jar" -exec grep -Hsli IdentityHashingStrategy {} \; ./trove-3.0.3.jar </code></pre> <p>If the JAR could be <em>anywhere</em> in the system and the <a href="http://www.linfo.org/locate.html" rel="noreferrer"><code>locate</code></a> command is available:</p> <pre><code>for i in $(locate "*.jar"); do echo $i; jar -tvf $i | grep -Hsi ClassName; done </code></pre> <h1>Windows</h1> <p>Open a <a href="https://conemu.github.io/" rel="noreferrer">command prompt</a>, change to the directory (or ancestor directory) containing the JAR files, then:</p> <pre><code>for /R %G in (*.jar) do @jar -tvf "%G" | find "ClassName" &gt; NUL &amp;&amp; echo %G </code></pre> <p>Here's how it works:</p> <ol> <li><code>for /R %G in (*.jar) do</code> - loop over all JAR files, recursively traversing directories; store the file name in %G.</li> <li><code>@jar -tvf "%G" |</code> - run the Java Archive command to list all file names within the given archive, and write the results to standard output; the <code>@</code> symbol suppresses printing the command's invocation.</li> <li><code>find "ClassName" &gt; NUL</code> - search standard input, piped from the output of the jar command, for the given class name; this will set <code>ERRORLEVEL</code> to 1 iff there's a match (otherwise 0).</li> <li><code>&amp;&amp; echo %G</code> - iff <code>ERRORLEVEL</code> is non-zero, write the Java archive file name to standard output (the console).</li> </ol> <h1>Web</h1> <p>Use a <a href="https://www.google.ca/search?q=JAR+search+engine" rel="noreferrer">search engine</a> that scans <a href="http://www.findjar.com/" rel="noreferrer">JAR files</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload