Java Files check if a path is directory
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws IOException { Path path = Paths.get("Main.java"); boolean b = Files.isDirectory(path); System.out.println(b);//from w w w .j av a 2 s . co m } }