Find a jar file given the class name?

后端 未结 17 2035
无人共我
无人共我 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条回答
  •  萌比男神i
    2020-11-29 19:27

    Printing the list as I go so I can see what I'm checking. Mostly I'm looking in a lib/app directory, but you can substitute a locate for the find.

    e.g.

    for jar in $(find some_dir/lib -name "*.jar" ); 
    do
    echo -------------$jar-------------------
    jar -tf $jar | grep TheNameOfTheClassImLookingFor
    done
    

提交回复
热议问题