Here you can find the source of normalizePath(String path)
public static final String normalizePath(String path)
//package com.java2s; public class Main { public static final String normalizePath(String path) { path = path.replaceAll("\\\\", "/"); while (path.startsWith("./")) path = path.substring(2);//from w w w . j av a 2 s .c o m while (path.startsWith("/")) path = path.substring(1); while (path.endsWith("/.")) path = path.substring(0, (path.length() - 2)); int pathLength; do { pathLength = path.length(); path = path.replaceAll("\\/\\.\\/", "/"); } while (path.length() < pathLength); return path; } }