使用我的ClassFinder實用程序。它很簡單,快速,併爲此目的而建造!
http://www.adarshr.com/papers/classfinder
Usage:
java -jar cf.jar SEARCH [DIRECTORY] [OPTIONS]...
Searches all JAR files in the current directory and its sub-directories for
entries matching the SEARCH argument. If DIRECTORY is provided, searching will
be done in that location instead of the current directory.
SEARCH:
A search string containing the class name (entry name). Wild card (*) is
supported. Package separator can be either of `/', `\' or `.'.
Examples:
java.lang.String
java/util/ArrayList
java/lang/Str*B*er
If non ".class" entries also need to be searched, option -a (--all-types)
should be specified. Please see the OPTIONS section for a more detailed
explanation.
DIRECTORY:
If this is not provided, current directory and all its sub-directories will
be used for performing the search. However, if this argument is provided,
the same and its sub-directories will be used as the location to fetch JAR
files from.
If a recursive scan is not needed, option -s (--shallow) can be specified.
OPTIONS:
-h --help
Shows this help
-o [path] --redirect-output
Redirect output to a file path supplied.
-x [x1,x2] --archive-extensions
Extensions in addition to the default ".jar". Comma or space
separated list accepted.
-i --insensitive-case
Case insensitive search.
-q --quiet
Silent search without the progress bar animation.
-a --all-types
Removes the filtering on ".class" types so that other types
such as ".properties", ".xml", etc can also be searched for.
-s --shallow
Performs a shallow search. Doesn't recurse.
Examples:
java -jar cf.jar org/apache/log4j/Level D:\Frameworks
java -jar cf.jar *OracleDriver C:\oracle -x jar,zip
java -jar cf.jar messages.properties D:\IBM\WebSphere -a -x jar,war,ear
java -jar cf.jar util.* D:\Java -i -q
如果'findclass'是第二個批處理文件,你會想'CALL findclass'所以它將控制權返回給第一個批處理文件。或者,如果findclass.bat只是一行代碼,那麼您可以放棄第二批文件並直接運行該行。 – aphoria 2011-03-10 15:43:45
對!那麼該行就是'FOR/R %% A IN(* .jar)DO jar tf %% A' – 2011-03-10 16:09:06
@ wang.chance:只是澄清:* PA *的最後一條建議意味着只有一個批處理文件做所有*工作。沒有'jarfiles.txt'和沒有'findclass.bat'。在我看來,這是一個完美的替代品。 – 2011-03-10 16:43:02