Java – jarscan, which scans all jar files of a specific class in all subfolders
•
Java
We are seeing an older version of the class being used, although we have the latest deployment To scan all jar files in all subfolders of the application server, how do we write a small shell script to print the file name of the jars file that displays this particular class?
Solution
It's like:
find . -name '*.jar' | while read jarfile; do if jar tf "$jarfile" | grep org/jboss/Main; then echo "$jarfile"; fi; done
You can pack it like this:
jarscan() { pattern=$(echo $1 | tr . /) find . -name '*.jar' | while read jarfile; do if jar tf "$jarfile" | grep "$pattern"; then echo "$jarfile"; fi; done }
Then jarscan.org jboss. Main will search for this class in all jar files found in the current directory
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码