Linux cmd to search for a class file among jars irrespective of jar path

前端 未结 8 714
灰色年华
灰色年华 2021-01-29 23:58

I want to search for a particular class file among many jar files without giving the location of each jar file.

Is this possible with a simple command?

I tried t

8条回答
  •  执念已碎
    2021-01-30 00:57

    I have used this small snippet. Might be slower but works every time.

    for i in 'find . -type f -name "*.jar"'; do
        jar tvf $i | grep "com.foo.bar.MyClass.clss";
        if [ $? -eq 0 ]; then echo $i; fi;
    done
    

提交回复
热议问题