Search all JARs for a class

Writing by on Wednesday, 10 of October , 2012 at 9:48 pm

If you need to search for a class (say HelloWorld) in a lib/ folder with several other jars just to see if it exists, here’s a simple command to confirm that.

find ./lib/*.jar -exec jar -tf ‘{}’ \; | grep HelloWorld.class

For a more detailed listing, you can use my findClass.sh script shown below.

#!/bin/sh

# Check usage
if [ $# -lt 2 ] ; then
    echo "Syntax: $0  <Class> <Folder>"
    echo "Example: $0 HelloWorld.class ./lib/a*.jar"
    exit 1
fi

PATTERN=$1
shift
FILES=$@

# Loop over files and print info for those that match
for f in $FILES
do
	LINES=`jar -tf $f | grep $PATTERN | wc -l`
	if [ $LINES -ge 1 ] ; then
		echo -e "\n\n**** Found match in:" $f " ****\n"	
		jar -tf $f | grep $PATTERN 
	fi
done

Leave a comment

Category: Java,Linux

Pidgin Sipe Errors and getting it to work

Writing by on Friday, 5 of October , 2012 at 4:14 am

Pidgin is a pretty nifty IM client and sipe is a nice plugin for Microsoft LCS/OCS (Lync/Office Communicator). I need it only for work related IM (Lync).

On Ubuntu, installing it is a simple sudo apt-get install pidgin-sipe. I loved how it just worked initially. But, you know problems are going to start soon!

Read Error when you connect : To fix it, add the following to your .bashrc.

$ vi ~/.bashrc

# add this line and save
alias mypidgin=’export NSS_SSL_CBC_RANDOM_IV=0; /usr/bin/pidgin &’

$ source ~/.bashrc

Then start pidgin from the terminal.

$ mypidgin

I found this answer after Google Searches on askubuntu and Matt Woodward’s Blog

Next problem, the pidgin window doesn’t show up … So here’s the workaround that I use that works for me.

$ mypidgin
$ pidgin
Exiting because another libpurple client is already running.

Ignore the warning, but at least the window will show up. So for now, pidgin-sipe is working well.

Comments (1)

Category: Linux

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.