Here you can find the source of isValidPath(String path)
public static boolean isValidPath(String path)
//package com.java2s; //License from project: Open Source License import java.nio.file.InvalidPathException; import java.nio.file.Paths; public class Main { public static boolean isValidPath(String path) { try {//ww w .j ava 2 s . co m Paths.get(path); } catch (InvalidPathException ex) { return false; } return true; } }