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 findClass.sh

class=$1
dir=”/home/laurent/NetBeansProjects/libraries/teamsite/lib”
for file in $dir/*.jar
do
output=`jar -tf $file | grep $class`
if [ “$output” != “” ]
then
echo “==> $file”
jar -tf $file | grep $class
fi
done

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.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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