(1)
/etc/profile
Export java_home=/usr/java/jdk1.7.0_67-cloudera/
Export path= $PATH: $JAVA _home/bin
Export jre_home= "$JAVA _home/jre"
Export classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/rt.jar
After the change is complete, use the source/etc/profile command to update;
(2) The following steps are more important. Because OPENJDK is preinstalled on many Linux systems, the default is not what we want to set up, even if these settings are set above. Suppose you want to really use our own JDK. Also need to step:
sudo update-alternatives--install/usr/bin/java Java/usr/java/jdk1.7.0_67-cloudera/bin/java 300
sudo update-alternatives--install/usr/bin/javac Javac/usr/java/jdk1.7.0_67-cloudera/bin/javac 300
(The 300 here is just a sign.) It doesn't make sense, it's just the next step.)
(3) When you are done, use the java-version command to view our Java environment variables, showing examples such as the following:
Java Version "1.7.0_05"
Java (TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot (TM) Server VM (build 23.1-b03, Mixed mode)
* For updating a/usr/bin/xxx command point to a new path can be used sudo update-alternatives--config xxx
How to change the default openjdk for your own JDK installed in Linux