4
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jarファイルの中を検索する方法

Posted at

#はじめに
このクラスファイルどのjarに入ってるんだろう?って時に特定ディレクトリ配下のjar内をまとめて検索する方法

##以下のコマンドを実行するだけ

for FILE in $(find 検索ディレクトリ -name '*.jar') ; do echo $FILE ; jar -tvf $FILE | grep 検索したいファイル ; done

###実行例

[root@server01 ~]# for FILE in $(find /usr/lib/jvm -name '*.jar') ; do echo $FILE ; jar -tvf $FILE | grep String.class ; done
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/lib/jconsole.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/lib/ibmorbtools.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/lib/dt.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/lib/tools.jar
   817 Thu Apr 20 05:15:06 JST 2017 com/sun/tools/javac/api/Formattable$LocalizedString.class
  2990 Thu Apr 20 05:23:04 JST 2017 com/sun/tools/jdi/JDWP$VirtualMachine$CreateString.class
  1346 Thu Apr 20 05:16:12 JST 2017 com/sun/xml/internal/rngom/parse/compact/CompactSyntax$LocatedString.class
  1263 Thu Apr 20 05:16:00 JST 2017 com/sun/xml/internal/xsom/XmlString.class
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/ibmjsseprovider2.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/ibmsaslfw.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/tools/monitoring-api.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/se-service.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/management-agent.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/aggressive.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/dataaccess.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/ibmjgssfw.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/charsets.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/ibmcfw.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/amd64/default/jclSC180/vm.jar
 35433 Wed Apr 19 10:19:28 JST 2017 java/lang/String.class
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/amd64/default/jclSC180/j9zip.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/amd64/compressedrefs/jclSC180/vm.jar
 35433 Wed Apr 19 10:19:28 JST 2017 java/lang/String.class
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/amd64/compressedrefs/jclSC180/j9zip.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/ibmorb.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/security/US_export_policy.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/security/local_policy.jar
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.4.5-1jpp.1.el7_3.x86_64/jre/lib/math.jar
(略)
[root@server01 ~]#
4
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?