We would like to know how to check to see if a path is absolute.
import java.nio.file.FileSystems; import java.nio.file.Path; // w ww . j a va 2 s . co m public class Main { public static void main(String[] args) { Path path = FileSystems.getDefault().getPath("/home/docs/status.txt"); System.out.println(path.isAbsolute()); } }
The code above generates the following result.