Java Root Path Get getRootPath()

Here you can find the source of getRootPath()

Description

get Root Path

License

Apache License

Declaration

public static String getRootPath() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.io.IOException;

public class Main {

    public static String getRootPath() {
        return getPath();
    }/*ww  w .j a  v a 2 s  .co  m*/

    public static String getPath(String x) {
        String path = "";
        try {
            File file = new File(".");
            path = file.getCanonicalPath() + "\\" + x + "\\";
        } catch (IOException e) {
            System.out.println("com.job5156.util.FileUtil getPath()  error :" + e.getMessage());
        }
        return path;
    }

    public static String getPath() {
        String path = "";
        File file = new File(".");
        try {
            path = file.getCanonicalPath();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return path;
    }
}

Related

  1. getRootName(File f)
  2. getRootName(String fnm)
  3. getRootName(String pathname)
  4. getRootPath()
  5. getRootPath()
  6. getRootPath(String testDir)
  7. getRootPathName()