Karlovsky120 Karlovsky120 - 1 year ago 130
Java Question

Get path object from file

Is it possible to get a Path object from a


I know you can convert a path to a file using
method, but I couldn't find the opposite conversion. Is there a way to do this in Java 6 or lower?

Answer Source

Yes, you can get it from the File object by using File.toPath(). Keep in mind that this is only for Java 7+. Java versions 6 and below do not have it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download