{"id":504,"date":"2016-02-17T09:09:07","date_gmt":"2016-02-17T03:39:07","guid":{"rendered":"http:\/\/www.cyberaka.com\/?p=504"},"modified":"2016-02-17T09:09:07","modified_gmt":"2016-02-17T03:39:07","slug":"finding-class-inside-a-bunch-of-jar","status":"publish","type":"post","link":"https:\/\/www.cyberaka.com\/?p=504","title":{"rendered":"Finding class inside a bunch of jar"},"content":{"rendered":"<p>Many times there are some Java linkage errors and I have to find out in which jar files the class files are located. So this has lead me to find out tools which can do this job for me. I usually get the job done by using this excellent open source tools named <a href=\"https:\/\/github.com\/javalite\/jar-explorer\">Jar Explorer<\/a> inside Github. It is basically a platform independent Swing based utility which allows you to recursively search inside Jar files located inside a folder for any class name String. So it is possible for me to search for a class named &#8220;LoggingEvent&#8221; inside a folder containing lots of jars and it outputs the list of all the jar files where it found classes containing the text &#8220;LoggingEvent&#8221;.<\/p>\n<p>However when you are connected to Linux consoles using ssh and don&#8217;t have access to X Windowing system then you have to rely on either text based java program or pure vanilla shell scripting. For this situation I use the following snippets of code which I found from a <a href=\"http:\/\/stackoverflow.com\/questions\/1342894\/find-a-class-somewhere-inside-dozens-of-jar-files\">Stackoverflow article<\/a>.<\/p>\n<p>On Linux\/Mac<br \/>\n<code>for i in *.jar; do jar -tvf \"$i\" | grep -Hsi ClassName && echo \"$i\"; done<\/code><\/p>\n<p>On Windows<br \/>\n<code>for \/R %G in (*.jar) do @jar -tvf \"%G\" | find \"ClassName\" > NUL && echo %G<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many times there are some Java linkage errors and I have to find out in which jar files the class files are located. So this has lead me to find out tools which can do this job for me. I usually get the job done by using this excellent open source tools named Jar Explorer [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,35,23,24,32,25],"tags":[54,55],"class_list":["post-504","post","type-post","status-publish","format-standard","hentry","category-linux-os","category-mac-os","category-programming","category-tips-and-tricks","category-tools-and-utilities","category-windows-os","tag-find-class-in-jars","tag-locate-class-in-jars"],"_links":{"self":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=504"}],"version-history":[{"count":1,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/504\/revisions"}],"predecessor-version":[{"id":505,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/504\/revisions\/505"}],"wp:attachment":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}