Open any file or folder in java

Complete source code will show you, how to open any files or folders using java in windows.What you must know is :


rundll32 SHELL32.DLL,ShellExec_RunDLL File_Or_Folder_To_Open


What is rundll32.exe And Why Is It Running?


****************************************************************
COMPLETE SOURCE CODE FOR : OpenFileUsingJava.java
****************************************************************


public class OpenFileUsingJava
{
public static void main(String[]args)
{
try
{
//Path for folder or file that you want to open
//In my case i will open C:\ drive
//So create a String like below
//Don't forget to change \ to \\
String a="C:\\";

//Execute command
//Command that you must know : rundll32 SHELL32.DLL,ShellExec_RunDLL File_Or_Folder_To_Open
Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \""+a+"\"");
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}


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