Java Root Directory Get getRoot()

Here you can find the source of getRoot()

Description

get Root

License

Open Source License

Declaration

private static String getRoot() 

Method Source Code

//package com.java2s;
/**//from   ww w . ja va2  s  .co m
 * Copyright (C) 2009 Future Invent Informationsmanagement GmbH. All rights
 * reserved. <http://www.fuin.org/>
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 3 of the License, or (at your option) any
 * later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.File;
import java.io.IOException;

public class Main {
    private static String getRoot() {
        try {
            return new File("/").getCanonicalPath();
        } catch (final IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}

Related

  1. getRoot()
  2. getRoot()
  3. getRoot()
  4. getRoot()
  5. getRoot()
  6. getRoot(File child)