Java Path convert to File object
import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path p = Paths.get("c:/a/b/c/d/e/Main.java"); System.out.println("File:" + p.toFile()); }/*from ww w.j av a 2 s . c om*/ }