Use /usr/libexec/java_home -v 1.8 command on a terminal shell to figure out where is your Java 1.8 home directory
/usr/libexec/java_home -v 1.8
If you just want to find out the home directory of your most recent version of Java, omit the version. e.g. /usr/libexec/java_home
/usr/libexec/java_home
You could use echo $(/usr/libexec/java_home) command in your terminal to know the path where Java being installed.
echo $(/usr/libexec/java_home)
Turns out that I actually had the Java 7 JRE installed, not the JDK. The correct download link is here. After installing it, jdk1.7.0jdk appears in the JavaVirtualMachines directory.
jdk1.7.0jdk