************************************************************************
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
************************************************************************


NM Infotech has been serving worldwide customers ranging from India to USA, since 2008. NM Infotech specializes in design and development of highly intuitive and professional web and business solutions for small and medium sized business organisations. We believe in walking with our clients at every step during the journey of development and success of their business.
ReplyDeleteGood tip thanks for sharing
ReplyDeletethank you for the knowledge..
ReplyDeletehow can i take user input to accept the file and then open the file?
Thank you for sharing the code :)
ReplyDelete