Package com.germinus.easyconf
Class ClasspathUtil
- java.lang.Object
-
- com.germinus.easyconf.ClasspathUtil
-
public class ClasspathUtil extends java.lang.Object
Contains util methods to search in the classpath- Author:
- jferrer
-
-
Field Summary
Fields Modifier and Type Field Description private static Log
log
-
Constructor Summary
Constructors Constructor Description ClasspathUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Class
locateClass(java.lang.String name)
Return the Class object of the specified class name by searching the current classpath and the system classpath.static java.lang.Class[]
locateClasses(java.lang.String[] classNames)
Return an array of Class objects for each of the class names specified.static java.net.URL
locateResource(java.lang.String name)
Return the location of the specified resource by searching the user home directory, the current classpath and the system classpath.static java.net.URL
locateResource(java.lang.String base, java.lang.String name)
Return the location of the specified resource by searching the user home directory, the current classpath and the system classpath.
-
-
-
Method Detail
-
locateClass
public static java.lang.Class locateClass(java.lang.String name) throws java.lang.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:
java.lang.ClassNotFoundException
-
locateClasses
public static java.lang.Class[] locateClasses(java.lang.String[] classNames) throws java.lang.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:
java.lang.ClassNotFoundException
-
locateResource
public static java.net.URL locateResource(java.lang.String base, java.lang.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 resourcename
- the name of the resource- Returns:
- the location of the resource or
null
if it has not been found
-
locateResource
public static java.net.URL locateResource(java.lang.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
-
-