Java Is Path Exist isPathExists(String path)

Here you can find the source of isPathExists(String path)

Description

judge a path has existed

License

Open Source License

Parameter

Parameter Description
path a str of dir path

Return

if dir has existed then return true otherwise return false

Declaration

public static boolean isPathExists(String path) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    /**// www. j ava  2  s.  c om
     * judge a path has existed
     *
     * @param path a str of dir path
     * @return if dir has existed then return true otherwise return false
     */
    public static boolean isPathExists(String path) {
        if (path == null || path.isEmpty()) {
            throw new IllegalArgumentException(
                    "the arg: path can not be null or empty");
        }

        return new File(path).exists();
    }
}

Related

  1. isPathExist(String path)