How do I figure out what CLASSPATH the system classloader is using (for debugging)?

Tripp Lilley

First, a clarification: The "system classloader" is a series of protected final methods implemented in the abstract class java.lang.ClassLoader. You can't instantiate this class directly, and it's up to your JRE to implement its base functionality. Some documentation calls this the "default classloader," too.

Second, a warning: when you're debugging this way, you really need to be sure that you want to know what classloader it is you're actually debugging. The property we use isn't necessarily used by any other classloader.

Third, a scope limitation: this answer applies to the Sun JDK/JRE family of JVM implementations. Because the "default classloader" is a JRE-specific implementation issue, mileage may vary with other JREs.

Finally, the answer:

String cp = java.lang.System.getProperty("java.class.path");
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact