Java Path check if path is absolute path
import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path p1 = Paths.get("C:", "myData", "Main.java"); System.out.println(p1);/*from w w w .j av a 2 s . c o m*/ System.out.println("Absolute Path: " + p1.isAbsolute()); p1 = Paths.get("local", "myData", "Main.java"); System.out.println(p1); System.out.println("Absolute Path: " + p1.isAbsolute()); } }