I installed Oracle Java JDK 8 but java command line is still reporting it is version 7
I had the same problem on OS X Yosemite 10.9.

The problem was solved by installing the Java SE Development Kit 8.

I had installed the other version that is not a SE development kit and it was just working in web browsers, not for the terminal.