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

What is different between i++ and ++i

I want to share with you about different between i++ and ++i.

++i
**********
int i=0;
System.out.println(++i);
**********
It will print on screen 1


i++
**********
int i=0;
System.out.println(i++);
**********
It will print on screen 0

Answer :
++i will add current i value with 1 before print


i++ will add current i value with 1 after print
Related Posts Plugin for WordPress, Blogger...

I Also Can Create T-Shirt Logo For You