How to resolve JDK version error

Hi,

I have JDK 1.7 installed on my mac (Yosemite)
I am using Unity 4.3.4. When running my project for android from within Unity, I get the error:

/Doraemon/Doremon Run/Temp/StagingArea/bin/classes" -source 1.6 -target 1.6 -encoding ascii “com/google/android/gms/R.java” “com/google/unity/R.java” “samstudio/games/doraemonrun/R.java”
warning: java/lang/Object.class(java/lang/Object.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.

-source 1.6 -target 1.6 suggests me that unity is searching for JDK 1.6.
Will upgrading to Unity 4.6 resolve this problem or something else needs to be done.

For your mac you’re probably still kinda pointing to JDK 1.6 as your default

try this in terminal

sudo ln -nsf /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

Though obviously replace the jdk1.8.0_25.jdk with where ever yours is.