To Configure Java JDK (Mac OSx)
Edit the startup file (~/.bashrc).
Modify PATH variable.
Make sure that the JDK /bin directory of the version you want to configure is the first item in your PATH environment variable. The example below configures JDK 1.8:
PATH=/usr/local/jdk1.8.0/bin:$PATH export PATH
Save and close the file.
Load the startup file.
> . /.profile
To verify that your installation was configured correctly, type:
> java -version
This should print the version of the java tool.
If the version is other than your desired JDK, or you get the error "java: Command not found", then the JDK is not properly installed.