Monday, December 24, 2012

Debug class-not-found exception

Print ClassNotFoundException

A simple problem that I have found many people struggling with – how to print class-path. Following is the line that can be used to print classpath.

Arrays.toString((((URLClassLoader) Test.class.getClassLoader().getURLs()));

This code returns an array list of all jars and directories on the classpath of the classloader.

-          Sarang Anajwala

 

No comments:

Post a Comment