Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command line tool to tell me which JAR a particular Class is in

Tags:

java

Is there a command line tool that will crack open a JAR file and locate a particular .class file in it? Something that would let me walk a directory tree in search of which Jar(s) have a particular class like...

find . -name *jar -exec jaregrep -l "org.bob.PriceListViewUpdate" {} \;
REST/prices.jar
v2/REST/prices.jar

Something like this must exist. Where do I get it?

like image 327
Bob Kuhar Avatar asked Feb 22 '23 15:02

Bob Kuhar


2 Answers

If you know what directory the jar is you can use grep in linux. Run this command from a directory above the suspect jar files. It will tell you which jar file (or files) has it. I do this all the time when I'm looking for something in the mess of jars JBoss uses.

grep -rail --include=*.jar org.bob.PriceListViewUpdate
like image 68
Dev Avatar answered Feb 24 '23 03:02

Dev


JWhich provides command-line tools to find the jar file which contains the resource you are searching for.

like image 45
Aravind Yarram Avatar answered Feb 24 '23 04:02

Aravind Yarram