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 getClassUrl(Class<?> clazz) {
        return clazz.getResource("/" + clazz.getName().replace(".", "/") + ".class");
    }

    public static URL getJarUrl(String className) {
        try {
            Class<?> clazz = Class.forName(className);
            return clazz.getProtectionDomain().getCodeSource().getLocation();
        } catch (ClassNotFoundException e) {
            return null;
        }
    }

}

@@ -491,175 +491,145 @@
  get
-ClassUrl(Class%3C?%3E clazz) %7B%0A        return clazz.getResource(%22/%22 + clazz.getName().replace(%22.%22, %22/%22) + %22.class%22
+JarUrl(String className) %7B%0A        try %7B%0A            return getJarUrl(Class.forName(className)
 );%0A    
-%7D%0A%0A
     
-public static URL getJarUrl(String classNam
+%7D catch (ClassNotFoundException 
 e) %7B
@@ -629,37 +629,48 @@
 on e) %7B%0A        
+    
-try %7B
+return null;
 %0A            Cla
@@ -666,54 +666,68 @@
     
+%7D%0A
     
-Class%3C?%3E clazz = Class.forName(className);
+%7D%0A%0A    public static URL getClassUrl(Class%3C?%3E clazz) %7B
 %0A   
@@ -727,28 +727,24 @@
 ) %7B%0A        
-    
 return clazz
@@ -751,137 +751,69 @@
 .get
-ProtectionDomain().getCodeSource().getLocation();%0A        %7D catch (ClassNotFoundException e) %7B%0A            return null;%0A        %7D
+Resource(%22/%22 + clazz.getName().replace(%22.%22, %22/%22) + %22.class%22);
 %0A   

Reorder and simplify methods