Sunday, December 2, 2007

Find Class in JAR

How will i get to know which jar has required Class ?.

I do get NoClassDefFoundError or ClassNotFoundError, is there any approach to identify that the missed class is located in this jar and in which package ?.



In unix and windows(with unix utils) we have a spy(we can say) named as grep. This command used to search the specific words in a file. We can use the same command to find out the class located in jar file.

Unix :
grep -r *.jar

Windows:
grep -r *

In windows, sometime wildcard only for jar will not work. This may be issue with my machine. But try for customizing wild card, if works, show little smile.


The above command will list referenced and refering jar list, we have to identify manually walkthroughwing the content of JAR using tools like WinZIP, WINRAR, Stuffit.

No comments:

Post a Comment

Recent Posts

Unix Commands | List all My Posts

Texts

This blog intended to share the knowledge and contribute to JAVA Community such a way that by providing samples and pointing right documents/webpages. We try to give our knowledege level best and no guarantee can be claimed on truth. Copyright and Terms of Policy refer blogspot.com