Java Utililty Methods Class Path Create

List of utility methods to do Class Path Create

Description

The list of methods to do Class Path Create are organized into topic(s).

Method

StringgetClassBasePath(URL classUrl, Class clazz)
get Class Base Path
return getClassBasePath(classUrl, clazz.getName());
ListgetClassPathArchiveContents(final URL resource)
If the resource represents a classpath archive (i.e.
final List<String> contents = new ArrayList<String>();
if (isArchive(resource)) {
    final ZipFile archive = getArchive(resource);
    if (archive != null) {
        for (final Enumeration<? extends ZipEntry> entries = archive.entries(); entries
                .hasMoreElements();) {
            final ZipEntry entry = entries.nextElement();
            contents.add(entry.getName());
...
URLgetClasspathResourceURL(String resourceName)
Get URL of a classpath resource
return Thread.currentThread().getContextClassLoader().getResource(resourceName);
URLgetClasspathUrl(final Class aClass, final String aPath)
get Classpath Url
if (aPath != null && aPath.startsWith(CLASSPATH_PREFIX)) {
    return getResourceUrl(aClass, aPath.substring(CLASSPATH_PREFIX.length()));
} else {
    return null;
URLgetClasspathURL(final String name)
Gets the class path of a resource.
return ClassLoader.getSystemResource(name);
URL[]getClasspathURLs(String classpath)
Utility method that converts the components of a String representing a classpath into file URL(s).
StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator);
URL[] urls = new URL[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
    urls[i] = new File(st.nextToken()).getCanonicalFile().toURI().toURL();
return urls;