27 Şubat 2012 Pazartesi

Java - Open folder or directory using java

import java.util.*;
import java.io.*;
import java.awt.Desktop;

class OpenFolderInJava{

public static void main(String[] arg){
String path = "."; // path to the directory to be opened
File file = new File("C:\\");
Desktop desktop = null;
// Before more Desktop API is used, first check
// whether the API is supported by this particular
// virtual machine (VM) on this particular host.
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
try {
desktop.open(file);
}
catch (IOException e){
}
}
}

Hiç yorum yok:

Yorum Gönder