Get parent Path in Java
Description
The following code shows how to get parent Path.
Example
/* w w w . j av a 2 s . co m*/
import java.nio.file.Path;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) throws Exception{
Path listing = Paths.get("/usr/bin/zip");
System.out.println("Parent Path [" + listing.getParent() + "]");
}
}
The code above generates the following result.