First run /usr/libexec/java_home -V which will output something like the following:
Pick the version you want to be the default (1.6.0_65-b14-462 for arguments sake) then:
or you can specify just the major version, like:
Add the export JAVA_HOME… line to your shell’s init file.
Updating the .zshrc file should work:
Press CTRL+X to exit the editor Press Y to save your changes