How to see which Jars are used or loaded for my Java program?

Posted: June 24, 2016 by Narendra Shah in Uncategorized

Many times, it happens, we see very odd error, because of old jars loaded first and our apis are using new apis, and it is sometimes not easy to find, which jars are loaded first. How to find solution  ?

Simple solution, use “ps -efww | grep java” command  or from program, if wanted to know, add following lines in code, which will print all jars used.

 

URLClassLoader classLoader = (URLClassLoader) RedisMainApp.class.getClassLoader();
System.out.println(Arrays.toString(classLoader.getURLs()));

 

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