Java Paths.get(URI uri)

Syntax

Paths.get(URI uri) has the following syntax.

public static Path get(URI uri)

Example

In the following code shows how to use Paths.get(URI uri) method.


import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
// w ww.  j av  a 2 s  . co m
public class Main {

  public static void main(String[] args) {

    Path path = Paths.get(URI.create("file:///tutorial/Java/JavaFX/Topic.txt"));
    System.out.println(path);

    path = Paths.get(URI.create("file:///C:/tutorial/Java/JavaFX/Topic.txt"));
    System.out.println(path);

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio.file »




DirectoryStream.Filter
Files
FileStore
FileSystem
FileVisitor
Path
Paths
WatchService