During your initial Ambari Server Setup, you selected the JDK to use or provided a path to a custom JDK already installed on your hosts.
Use the following procedure to change the JDK:
Re-run Ambari Server Setup.
ambari-server setup
At the prompt to change the JDK, Enter y.
Do you want to change Oracle JDK [y/n] (n)? y
At the prompt to choose a JDK, Enter 1 to change the JDK to v1.7.
[1] - Oracle JDK 1.7 [2] - Oracle JDK 1.6 [3] - Custom JDK Enter choice: 1
If you choose Oracle JDK 1.7 or Oracle JDK 1.6, the JDK you choose downloads and installs automatically.
If you choose Custom JDK, verify or add the custom JDK path on all hosts in the cluster.
After setup completes, you must restart each component for the new JDK to be used by the Hadoop services.
Using the Ambari Web UI, do one of the following:
Restart each component
Restart each host
Restart all services