Here you can find the source of getCanonicalPath(File file)
public static String getCanonicalPath(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; public class Main { /**//from ww w. j ava 2s. c o m * Returns the canonical path to a directory * * @return Path to directory */ public static String getCanonicalPath(File file) { String canonicalPath = ""; try { canonicalPath = file.getCanonicalPath(); } catch (IOException ignored) { } return canonicalPath; } }