If you haven't already, install homebrew. See https://brew.sh/
Install jenv. brew install jenv.
Add jenv to the bash profile. ...
Add jenv to your path. ...
Tap "caskroom/versions" ...
Install the latest version of java. ...
Install java 6 (or 7 or 8 whatever you need) ...
Review Installations.