This is all getting confusing....
First things first,
1. You need to have jdk installed to compile java files . Default Install directory is : "C:\Program Files\Java\jdkXXXXXX" where XXXXXX is the installed jdk version.
2. Set value of the PATH variable as follows:
To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
Click Start > Control Panel > System on Windows
Click Advanced > Environment Variables.
Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
C:\Program Files\Java\jdk1.6.0_<version>\bin
PATH environment variable is a series of directories separated by semi-colons (;) and is not case sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.
You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored. If one is already present, update it to jdk1.6.0_<version>\bin.
If you are not sure where to add the path, add it to the right end of the PATH in the User Variables.
The new path takes effect in each new command window you open after setting the PATH variable.
3. To compile any java file, cd to the directory where it is located and type the command:
Directory>javac <yourFileName>.java
4. To execute a class file, cd to the containing directory and type:
java <yourClassName>
Hope this helps.....