Sunday, June 26, 2011

Find in which jar a class is defined!!

Useful when you have to deal with ClassNotFoundException. The command looks for all jar in the current directory and any sub-directory, and checks if the jar contains the specified class. The command lists all matching jars.

find -name "*.jar" -exec grep "CLASSNAME" {} \;
find -name "*.jar" -exec grep "org/junit/runners/Parameterized.class" {} \;

No comments:

Post a Comment