You’ve tried retrieve the hard drives or removable devices using java.io.File and passed “/” like parameter in class constructor? The result is the root of classpath, isn’t?
To obtain the hard drives or removable devices, use File.listRoots(). This code return a File array, where each index of array is a removable device or hard disk unit.
Follow this sample:
File[] units = File.listRoots();
for(File unit : units){
System.out.println(unit.getAbsolutePath());
}
June 23rd, 2010 on 01:39
Oh thank you!