Java IO Tutorial - Java Path.normalize()


Path.normalize() has the following syntax.

Path normalize()


In the following code shows how to use Path.normalize() method.

/*from  w  w  w. j  a v  a 2 s  .c o  m*/
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

  public static void main(String[] args) {
     Path path = Paths.get("C:/home/./music/users.txt");
     System.out.println("Normalized: " + path.normalize());


The code above generates the following result.