java获取当前目录及父目录和兄弟目录

2014-11-24 08:24:17 · 作者: · 浏览: 1
import java.io.*;

public class test{
    public static void main(String[] args) {
                // get current dir
		File file = new File(System.getProperty("user.dir"));
		// get parent dir
		String parentPath = file.getParent(); 
		#System.out.println(parentPath);
		// get brother dir
		String toolPath = parentPath + "/tool";
		#System.out.println(toolPath);
    }
}