public static String canonical(File p){
  try {
    return p.getCanonicalPath();
  }
 catch (  IOException e) {
    String x=p.getAbsolutePath();
    return x == null ? p.getPath() : x;
  }
}

public static String canonical ( File p ) { try { return p . getCanonicalPath ( ) ; } catch ( IOException e ) { String x = p . getAbsolutePath ( ) ; return x == null ? p . getPath ( ) : x ; } }
returns a full path to the provided file . returns the canonical path , unless that is not available , in which case it returns the absolute path .
