finding the jar for a class

Posted: 7 April 2011 in Uncategorized

Sometimes, you have the class and you wonder which jar file contains it. here is the solution, which I saved in

for file in $dir/*.jar
output=`jar -tf $file | grep $class`
if [ “$output” != “” ]
echo “==> $file”
jar -tf $file | grep $class

Today, I developed my first class for the latest version of Teamsite and that meant that all the usual paths on my previous were not applicable for this new environment I am working with. I wanted for once to use an economical approach and only include the jars I needed and so I used this method to great effect.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s