List contents of multiple jar files

前端 未结 9 836
情歌与酒
情歌与酒 2021-02-02 10:50

I am searching for a .class file inside a bunch of jars.

jar tf abc.jar 

works for one file. I tried

find -name \"*.jar\" | xa         


        
9条回答
  •  醉酒成梦
    2021-02-02 11:42

    You can also use unzip which is more faster than jar (-l option to print zip content).

    For instance, a small script that does roughly what you want:

    #!/bin/bash
    
    for i in $(find . -name "*.jar")
    do
        if [ -f $i ]
    then
        echo $i
        unzip -l $i | grep $*
    fi
    done
    

提交回复
热议问题