package com.janosgyerik.tools.util;

import java.net.URL;

public final class ClassPathUtils {

    private ClassPathUtils() {
        throw new AssertionError("utility class, forbidden constructor");
    }

    public URL getResourceUrl(String resourceName) {
        return getClass().getClassLoader().getResource(resourceName);
    }

    public static URL getJarUrl(Class<?> clazz) {
        return clazz.getProtectionDomain().getCodeSource().getLocation();
    }

    public static URL getJarUrl(String className) {
        try {
            return getJarUrl(Class.forName(className));
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException("class not found: " + className, e);
        }
    }

    public static URL getClassUrl(Class<?> clazz) {
        return clazz.getResource("/" + clazz.getName().replace(".", "/") + ".class");
    }

}

@@ -52,16 +52,65 @@
 t.URL;%0A%0A
+/**%0A * Utility methods related to classpath.%0A */%0A
 public f
@@ -258,264 +258,913 @@
     
-public URL getResourceUrl(String resourceName) %7B%0A        return getClass().getClassLoader().getResource(resourceName);%0A    %7D%0A%0A    public static URL getJarUrl(Class%3C?%3E clazz) %7B%0A        return clazz.getProtectionDomain().getCodeSource().getLocation();%0A    %7D%0A
+/**%0A     * Get the URL of a resource by name.%0A     *%0A     * @param resourceName name of the resource to find%0A     * @return URL of the resource%0A     */%0A    public URL getResourceUrl(String resourceName) %7B%0A        return getClass().getClassLoader().getResource(resourceName);%0A    %7D%0A%0A    /**%0A     * Get the URL of the JAR from which a class was loaded.%0A     *%0A     * @param clazz the class to find%0A     * @return the URL of the class%0A     */%0A    public static URL getJarUrl(Class%3C?%3E clazz) %7B%0A        return clazz.getProtectionDomain().getCodeSource().getLocation();%0A    %7D%0A%0A    /**%0A     * Get the URL of the JAR from which a class was loaded.%0A     * This can be useful when the Class instance is not available directly in the caller,%0A     * for example because it would be loaded further down the stack.%0A     *%0A     * @param className the name of the class to find%0A     * @return the URL of the class%0A     */
 %0A   
@@ -1424,24 +1424,189 @@
    %7D%0A    %7D%0A%0A
+    /**%0A     * Get the URL of the class file from which a class was loaded.%0A     *%0A     * @param clazz the class to find%0A     * @return the URL of the class%0A     */%0A
     public s

Document public methods