13,100
社区成员
发帖
与我相关
我的任务
分享
String dir = null; //欲得到目录绝对路径
Enumeration e = FileSystemRegistry.listRoots();
while (e.hasMoreElements()) {
dir = "file://localhost/" + e.nextElement() + "XXX/";
FileConnection fc = null;
try {
fc = (FileConnection) Connector.open(root, Connector.READ_WRITE);
if (fc.isDirectory()) {
break;
}
dir = null;
} catch (IOException ex) {
dir = null;
//do nothing
} finally {
try {
fc.close();
} catch (Exception ex) {
//do nothing
}
}
}