Package org.jolokia.jvmagent.client.util
Class ToolsClassFinder
java.lang.Object
org.jolokia.jvmagent.client.util.ToolsClassFinder
Utility class for looking up a class within tools.jar
- Since:
- 07.10.11
- Author:
- roland
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?>lookupClass(String pClassName) Lookup a class and return its definition.static Class<?>lookupInToolsJar(String pClassName) Searches fortools.jarin various locations and uses anURLClassLoaderfor loading a class from these files.
-
Method Details
-
lookupClass
Lookup a class and return its definition. This is first tried by the current classloader (which has loaded this class) and if this fails by searching for a tools.jar in various places.- Parameters:
pClassName- class name to lookup- Returns:
- the found class
- Throws:
ClassNotFoundException- if no class could be found
-
lookupInToolsJar
Searches fortools.jarin various locations and uses anURLClassLoaderfor loading a class from these files. If the class could not be found in any, then aClassNotFoundExceptionis thrown. The locations used for lookup are (in this order)- $JAVA_HOME/../lib/tools.jar
- $JAVA_HOME/lib/tools.jar
$JAVA_HOMEhere is the value of the system propertyjava.home- Parameters:
pClassName- class to lookup- Returns:
- the found class
- Throws:
ClassNotFoundException- if no class could be found
-