Create path from URI - Java File Path IO

Java examples for File Path IO:Path

Description

Create path from URI

Demo Code

import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
  public static void main(String[] args) {
    Path path = null;/*from   w  w  w.  j  a  v  a  2 s  .  c  o  m*/
    try {
      path = Paths.get(new URI("file:///C:/home/docs/users.txt"));
    } catch (URISyntaxException e) {
      System.out.println("Bad URI");
    }

  }
}

Related Tutorials