If /usr/libexec/java_home -v 1.8.0_05 --exec javac -version
returns the correct version, then your problem is with:
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
With a privileged user execute:
cd /System/Library/Frameworks/JavaVM.framework/Versions/
rm CurrentJDK
ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/ CurrentJDK
Solution found in Mankeh Blog
Also check this answer on Super User for dynamically switching JDK versions.
Update: I guess I’ve found the culprit!
Try this:
rm -rf ~/Library/Java/Extensions
sudo rm -rf /Library/Java/Extensions
Solution found in: Java 1.7 on OSX 10.9.2 running as 1.5?