After you install Java SDK in your Windows system, here are some things that you should do.
Right-Click My Computer and go to Properties.
Then click Advanced and the Environment Variables button.
Add a new Environment Variable called JAVA_HOME and enter the path where the java software is installed.
By Default: C:\Program Files\Java\jdk1.5.0\
append the following to the PATH variable after a semi colon.
Now wherever you want you can write your java file and compile & Run it.