Java Resource Load getResourceUrl(final Class aClass, final String aPath)

Here you can find the source of getResourceUrl(final Class aClass, final String aPath)

Description

get Resource Url

License

Open Source License

Declaration

public static URL getResourceUrl(final Class<?> aClass,
            final String aPath) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;

public class Main {
    public static URL getResourceUrl(final Class<?> aClass,
            final String aPath) throws IOException {
        final URL url = aClass.getResource(aPath);
        if (url == null) {
            throw new FileNotFoundException("Resource not found for "
                    + aClass.toString() + ": " + aPath);
        } else {/* ww  w . j a va  2 s. com*/
            return url;
        }
    }
}

Related

  1. getResourceStream(String resource, Class root)
  2. getResourceStreamFromClasspath(Class clazz, String resourceName)
  3. getResourceStreamInPackage(Class clazz, String name)
  4. getResourceString(String filename)
  5. getResourceUri(final String packageToScan, final ClassLoader classLoader)
  6. getResourceUrl(final String resourcePath)
  7. getResourceUrl(String path, String extension, ClassLoader loader)
  8. getResourceURL(String resourcePath)
  9. getResourceUrl(String resourcePath)