Here you can find the source of toSystemPath(String rawpath)
public static String toSystemPath(String rawpath)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; public class Main { /**// ww w . j a v a 2s. c o m * As the declared paths in this testcase might be actual paths on the system * running these tests, the expected paths should be cleaned up to represent * the actual system paths. * <p> * Eg: on fedora /etc/init.d is a symlink to /etc/rc.d/init.d */ public static String toSystemPath(String rawpath) { Path path = FileSystems.getDefault().getPath(rawpath); if (Files.exists(path)) { // It exists, resolve it to the real path try { path = path.toRealPath(); } catch (IOException e) { // something prevented us from resolving to real path, fallback to // absolute path resolution (not as accurate) path = path.toAbsolutePath(); e.printStackTrace(); } } else { // File doesn't exist, resolve to absolute path // We can't rely on File.toCanonicalPath() here path = path.toAbsolutePath(); } return path.toString(); } }