Here you can find the source of getAbsolutePathName(File dir)
public static String getAbsolutePathName(File dir)
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.IOException; import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static String getAbsolutePathName(File dir) { try {/*from w ww. j av a2 s.c o m*/ return getAbsolutePath(dir).toString(); } catch (IOException e) { return dir.getAbsolutePath(); } } public static Path getAbsolutePath(File dir) throws IOException { return Paths.get(dir.getPath()).toRealPath(LinkOption.NOFOLLOW_LINKS); } }