How to search for a string in JAR files

后端 未结 10 1156
小蘑菇
小蘑菇 2020-12-12 14:57

My application is built on Java EE.

I have approximately 50 jars in this application.

Is it possible to search for a particular keyword (actually I want to s

10条回答
  •  孤街浪徒
    2020-12-12 15:36

    The below command shows the results with the file name and jar file name.

    1. To find the string in the list of jar file.

      find <%PATH of the Folder where you need to search%> -name "*.jar" -print -exec zipgrep "jar$|<%STRING THAT YOU NEED TO FIND>" '{}' \;
      
    2. To find the class name in the list of jar file.

      find . -name "*.jar" -print -exec jar tvf {} \; |grep -E "jar$|<%CLASS NAME THAT YOU NEED TO FIND>\.class"
      

提交回复
热议问题