bash - Find for a class file in Linux that is present in JAR -
i trying find jar file contains class using below command given in link : find jar file given class name?
find . -name "*.jar" -exec sh -c 'jar -tf {}|grep -h --label {} genericclassloader' \; but getting error :
java.util.zip.zipexception: error in opening zip file @ java.util.zip.zipfile.open(native method) @ java.util.zip.zipfile.<init>(zipfile.java:131) @ java.util.zip.zipfile.<init>(zipfile.java:92) @ sun.tools.jar.main.list(main.java:997) @ sun.tools.jar.main.run(main.java:242) @ sun.tools.jar.main.main(main.java:1167) please me in understanding command , how solve error. using bash shell.
there in filesystem, ends *.jar isn't valid archive. debug this, add -print find command:
find . -name "*.jar" -print -exec ... this make find print name of file before tries execute sh command.
explanation:
find .: find files , folder in current directory-name "*.jar"name ends.jar-exec, execute following command each of themsh -ccreate new shell , execute ...jar -tf {}test jar archive. (also) prints list of files in archivefindreplace{}path of archive found|pipe result ofjar -tf...grepsearch input ...-hprint filename each match--label {}since we're reading stdin,grepshould use{}(again replaced find) filenamegenericclassloadersearch string in output ofjar -tf
Comments
Post a Comment