Java File get root directory
import java.io.File; public class Main { public static void main(String[] args) { File[] roots = File.listRoots(); System.out.println("Root directories:"); for (File f : roots) { System.out.println(f.getPath()); }/*from w w w . j a v a 2 s. c o m*/ } }