Java Path create from Paths
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 . jav a2 s .co m } }