public static boolean resourceExists(String resourcePath) {
        InputStream stream = null;
        boolean exists = false;

        try {
            stream = getInputStreamForPath(resourcePath);
            exists = true;
        } catch (IOException e) {
            stream = null;
        } finally {
            if (stream != null) {
                try {
                    stream.close();
                } catch (IOException ignored) {
                }
            }
        }

        return exists;
    }
Returns {@code true} if the resource at the specified path exists, {@code false} otherwise.  This
method supports scheme prefixes on the path as defined in {@link #getInputStreamForPath(String)}.

@param resourcePath the path of the resource to check.
@return {@code true} if the resource at the specified path exists, {@code false} otherwise.
@since 0.9
lang/src/main/java/org/apache/shiro/lang/io/ResourceUtils.java