| 23 | System.out.println("******************"); |
| 24 | } |
| 25 | public static void main(String[] args) { |
| 26 | System.out.println(System.getProperty("os.name")); |
| 27 | info(Paths.get( |
| 28 | "C:", "path", "to", "nowhere", "NoFile.txt")); |
| 29 | Path p = Paths.get("PathInfo.java"); |
| 30 | info(p); |
| 31 | Path ap = p.toAbsolutePath(); |
| 32 | info(ap); |
| 33 | info(ap.getParent()); |
| 34 | try { |
| 35 | info(p.toRealPath()); |
| 36 | } catch(IOException e) { |
| 37 | System.out.println(e); |
| 38 | } |
| 39 | URI u = p.toUri(); |
| 40 | System.out.println("URI: " + u); |
| 41 | Path puri = Paths.get(u); |
| 42 | System.out.println(Files.exists(puri)); |
| 43 | File f = ap.toFile(); // Don't be fooled |
| 44 | } |
| 45 | } |
| 46 | /* Output: |
| 47 | Windows 8.1 |