Open folder or directory in Windows 7 using java

Complete source code below will show you, how to open folder through java in Windows 7.

************************************************************************
COMPLETE SOURCE CODE FOR : OpenFolderInJava.java
Thank you to Ankur Pandya for this source codes.
************************************************************************

/// file OpenFolderInJava.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){
}
}
}

/// end of file ///


************************************************************************
JUST COMPILE AND EXECUTE
************************************************************************