Here you can find the source of getResourcePath(String resource)
Parameter | Description |
---|---|
resource | the resource to find |
public static String getResourcePath(String resource)
//package com.java2s; //License from project: Open Source License import java.net.URL; public class Main { /**/*from w ww. j a v a 2s . c o m*/ * Returns the path of the given resource. * The resource needs to be located inside a source folder and the resource name given relative to that, * including packages. * * @param resource the resource to find * @return the path of the resource, null if none found */ public static String getResourcePath(String resource) { return getResourceURL(resource).getPath(); } /** * Returns the {@link URL} of the given resource. * The resource needs to be located inside a source folder and the resource name given relative to that, * including packages. * * @param resource the resource to find * @return the URL of the resource, null if none found */ public static URL getResourceURL(String resource) { return ClassLoader.getSystemResource(resource); } }