Wednesday, April 06, 2005

Excerpts from Tom Ball's Blog: Exceptional Debugging

A rather clever way of checking whether a class exists in the current class path:

public boolean classExists(String name) {
String resource = name.replace('.','/') + ".class";
return getClass().getClassLoader().getResource(resource) != null;
}
This was suggested by a java.net use "brucechapman" in response to Tom Ball's latest blog entry - Exceptional Debugging

No comments: