class ResourceLocator {

    public static URL getResource(final String resource) throws MalformedURLException {
        final List<ClassLoader> classLoaders = Arrays.asList(Thread.currentThread().getContextClassLoader(),
                ResourceLocator.class.getClassLoader(), ClassLoader.getSystemClassLoader());

        final URL url = getResource(classLoaders, resource);

        return url == null ? new File(resource).toURI().toURL() : url;
    }

    private  ResourceLocator();

}