Yogesh's Blog

Sharing me with blog…
Archive for the ‘Jar’ Category

Many time in java development, we need to find out the java class availability in jar file. If there is one jar file then looking class in that is easy, but suppose there are lots of libraries (lots of jars) then to search in those libraries, really really tough task. Here is the solution for it, using JarScan… Steps to search: Put JarScan jar file in some location (Example: D:\Utils\)¬† (download JarScan from here) Open command prompt Use following command Syntex: java -jar <location-pointing-to-downloaded-jar-file> -dir <location-to-search-class-in> -class <classname-only-name-or-with-package> Example 1: java -jar D:\Utils\jarscan.jar -dir D:\myLibraries\ -class MyClassToSearch Example 2: java -jar D:\Utils\jarscan.jar -dir D:\myLibraries\ -class com.mycompany.mypackage.MyClassToSearch You will get list of library files who will be scanned and also finally detail of libraries where specified class is found. Details uses and syntex: Command: java -jar jarscan.jar [-help | /?] [-dir directory name] [-zip] [-showProgress] <-files | -class | -package> <search string¬† 1> [search string 2] [search string n] Command Help: Command option Description -help or /? Displays this message. -dir The directory to start searching from default is “.” -zip Also search Zip files -showProgress Show a running count of files read in -files or -class Search for a file or Java class contained in some library. i.e. HttpServlet -package Search for a Java package contained in some library. i.e. javax.servlet.http search string The file or package to search for. i.e. see examples above