It sounds like there is a problem with the PATH on your computer. The path tells the computer where to find the programs you are trying to use. The installer should set this up to point to the JDK, but often doesn't.
We'll go through how to set this up now.
First, we need to find the Java Development Kit. If you installed it somewhere unusual, you'll need to remember where. If you installed it in the default location, it will be somewhere like this:
"C:\Program Files (x86)\Java\jdk1.7.0_04\"
Though the numbers may vary. Find the JDK using Windows Explorer and make a note of its location.
Next, we need to point the PATH at this area, or more specifically the jdk 'bin' directory. This is set up in Window's Control Panel.
If you are in Windows 7, search 'settings' for 'Control Panel' and open it. If you are on another Windows system, go to 'Start Menu' -> 'Settings' -> 'Control Panel'.
Find 'System' in the Control Panel area.
Go to the 'Advanced' tab at the top.
Click the 'Environment Variables' button.
Environment variables are a set of variables most operating systems
have that control lots of things that are specific to your
computer - for example, where to store temporary files. We're interested
in the PATH
which tells the
computer where to look for program files to run.
Under 'System Variables' scroll down to PATH
. In the very unlikely event that you
can't find it, you'll need to create it using the 'New' button, but if this is the case, not much on
your computer will be working! If you
can find it, push the 'Edit' button.
The PATH is made up of directory lists, separated (in Windows) by semi-colons ';'. Even if you just have one directory, it needs to end with a semi-colon. Add a reference to the jdk bin directory to the front of the PATH, being careful not to delete anything else. So, for example, if the jdk was at the location given above, we'd add:
"C:\Program Files (x86)\Java\jdk1.7.0_04\bin\;"
Note the quote marks, as the directory has spaces in the names..
It is important to add this at the front of the PATH so that the computer doesn't first search through older copies of the JRE you may have already.
Once you've added the jdk path, save the PATH and 'OK' out of the Control Panel. Close your current command prompt window and re-open it (you MUST do this for the changes to be picked up). Navigate back to the Test.java file, try the following again, making sure you get exactly the right capitalisation (java is case-sensitive):
javac Test.java
If this works, you should see a blank line come back. Is this what you see?