If you are handling Linux/Unix/Mac OS X:
Examine this:
$ which java
Should output the correct position.
After that, you can fix the JAVA_HOME environment variable yourself.
In my PC (Mac OS X - Snow Leopard):
$ which java
/usr/bin/java
$ ls -l /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Nov 7 07:59 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
If you are working on Windows:
c:\> for %i in (java.exe) do @echo. %~$PATH:i