Software Development in Brisbane

JWhich in a line of code

Old skool java programmers will have almost certainly come across the tool JWhich (http://www.javaworld.com/javaworld/javatips/jw-javatip105.html).  It's the classic tool for finding out which jar file contains a class.  The following line of code has the same effect, and is slightly better than just trying to grep jar files.

com.ibm.websphere.management.AdminService.class. getClassLoader(). getResource( "com/ibm/websphere/management/AdminService.class");1

1 – after reading the source for JWhich I realised that I have just copied it exactly :)

One Response to “JWhich in a line of code”

  1. Recent Faves Tagged With "jar" : MyNetFaves Says:

    [...] beauty buys: clarins multi-active night cream First saved by KrazySteph14 | 14 days ago JWhich in a line of code First saved by kamiyra | 14 days ago Danger Daily News 8-31-08 First saved by SarahKate | 14 [...]

Leave a Reply