Okay actually I want to do this kind of stuff only using .bash_profile, switching path location between JDK version. But it’s kinda odd using that manual way, so I tried to find another method to do the switching more easily. Googling and finding out that I can use Brew and Jenv to do the switching JDK version.

First

Of course I have to install Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
 *paste that command on the terminal

Second

Instaling Jenv
$brew install jenv
after that adding this line to your .bash_profile
if which jenv > /dev/null; then eval "$(jenv init -)"; fi

Third

Adding your already installed JDK to Jenv
jenv add /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
Fourth
Switching JDK version, globally or locally(per directory). To find out the already added JDK in the Jenv setting, use this command
jenv versions

You will see a list of JDK version. Switching JDK version using pattern jenv global <available JDK when you run jenv versions>

jenv global 1.8