Class ClasspathUtil

java.lang.Object
com.germinus.easyconf.ClasspathUtil

public class ClasspathUtil extends Object
Contains util methods to search in the classpath
Author:
jferrer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Log
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Class
    Return the Class object of the specified class name by searching the current classpath and the system classpath.
    static Class[]
    locateClasses(String[] classNames)
    Return an array of Class objects for each of the class names specified.
    static URL
    Return the location of the specified resource by searching the user home directory, the current classpath and the system classpath.
    static URL
    Return the location of the specified resource by searching the user home directory, the current classpath and the system classpath.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      private static final Log log
  • Constructor Details

    • ClasspathUtil

      public ClasspathUtil()
  • Method Details

    • locateClass

      public static Class locateClass(String name) throws ClassNotFoundException
      Return the Class object of the specified class name by searching the current classpath and the system classpath.
      Parameters:
      name - the name of the class
      Returns:
      the Class instance
      Throws:
      ClassNotFoundException
    • locateClasses

      public static Class[] locateClasses(String[] classNames) throws ClassNotFoundException
      Return an array of Class objects for each of the class names specified. Each class will be searched for using the locateClass method. If any of the class names does not exist a ClassNotFoundException will be thrown
      Parameters:
      classNames - the names of the classes to load
      Returns:
      the Class[] array
      Throws:
      ClassNotFoundException
    • locateResource

      public static URL locateResource(String base, String name)
      Return the location of the specified resource by searching the user home directory, the current classpath and the system classpath.
      Parameters:
      base - the base path of the resource
      name - the name of the resource
      Returns:
      the location of the resource or null if it has not been found
    • locateResource

      public static URL locateResource(String name)
      Return the location of the specified resource by searching the user home directory, the current classpath and the system classpath.
      Parameters:
      name - the name of the resource
      Returns:
      the location of the resource or null if it has not been found