Find a jar file given the class name?

后端 未结 17 2088
无人共我
无人共我 2020-11-29 18:46

This must be a very basic question for Java developers, but what is the best way to find the appropriate jar file given a class name?

For example, give

17条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 19:39

    There is no "official" Java way to do this AFAIK.

    The way I usually hunt for it is to use find and jar to look through all jar files in a given tree.

    > find . -name \*.jar -print -exec jar tf {} oracle/sql/BLOB.class \;
    ./v2.6.1/lib/csw_library.jar
    ./v2.6.1/lib/oracle_drivers_12_01.jar
    oracle/sql/BLOB.class
    

    If you're on Windows and don't want to install Cygwin, then I suppose you would have to write a batch script to locate the jar files.

提交回复
热议问题