public static URL getResource(String resource) {
        if (resource == null)
            throw new NullPointerException("resource must not be null");
        if (resource.isEmpty())
            throw new IllegalArgumentException("resource must not be empty");
        if (resource.trim().isEmpty())
            throw new IllegalArgumentException("resource must not be blank");

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (resource.charAt(0) == '/')
            return classLoader.getResource(resource.substring(1));
        else
            return classLoader.getResource(resource);
    }