Class ToolsClassFinder

java.lang.Object
org.jolokia.jvmagent.client.util.ToolsClassFinder

public final class ToolsClassFinder extends Object
Utility class for looking up a class within tools.jar
Since:
07.10.11
Author:
roland
  • Method Details

    • lookupClass

      public static Class<?> lookupClass(String pClassName) throws ClassNotFoundException
      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

      public static Class<?> lookupInToolsJar(String pClassName) throws ClassNotFoundException
      Searches for tools.jar in various locations and uses an URLClassLoader for loading a class from these files. If the class could not be found in any, then a ClassNotFoundException is thrown. The locations used for lookup are (in this order)
      • $JAVA_HOME/../lib/tools.jar
      • $JAVA_HOME/lib/tools.jar
      $JAVA_HOME here is the value of the system property java.home
      Parameters:
      pClassName - class to lookup
      Returns:
      the found class
      Throws:
      ClassNotFoundException - if no class could be found