1. Find the configuration file. Profile in the / etc directory
2. Configure the three paths and update (note that the split character used in Linux: and used by window; in addition, do not forget to configure the classpath. He represents the current path)
JAVA_HOME=/opt/jdk1.8.0_121
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/lib:.
export JAVA_HOME PATH CLASSPATH
3.Update : source profile
Note: println () does not work in Linux, but it will not output the statement.