Define a Path from a URI - Java File Path IO

Java examples for File Path IO:Path

Description

Define a Path from a URI

Demo Code

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

public class Main {
  public static void main(String[] args) {

    Path path = Paths.get(URI
        .create("file:///folder1/folder2/folder3/test.txt"));
     path = Paths.get(URI// www  .  j  av a  2  s  .c o  m
        .create("file:///C:/folder1/folder2/folder3/test.txt"));
  }
}

Related Tutorials