I am using a shell script to find out files which contains a class file from a list of JAR files in UNIX using bash script:
find . -name "*.jar" -exec bash -c 'jar -tf {} |grep -H --label {} GenericClassLoader' \;
But I was getting error as :
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:131)
at java.util.zip.ZipFile.<init>(ZipFile.java:92)
at sun.tools.jar.Main.list(Main.java:997)
at sun.tools.jar.Main.run(Main.java:242)
at sun.tools.jar.Main.main(Main.java:1167)
I am taking help from this post : Find for a class file in Linux that is present in JAR
In order to avoid the error I have modified my query as:
find . -name "*.jar" -exec bash -c 'jar -tf {} 2>&/dev/null |grep -H --label {} GenericClassLoader' \;
But I started getting below errors:
bash: /dev/null: ambiguous redirect
Please help me in solving this issue, what is the issue with my command.