Install jdk under linux

1.
  Enter on the command line: yum -y install java-1.7.0-openjdk-devel.x86_64

2. Configure the environment variables and the
  download is complete. Enter at the command line: vi /etc/profile
  to enter edit mode Add
  #set java environment
  JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141.x86_64
  JRE_HOME=$JAVA_HOME/jre to the end of the text
  CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
  PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
  export JAVA_HOME JRE_HOME CLASS_PATH PATH

3. Exit the editor ( Press the esc key, then enter: wq Enter)

4. To make the modification take effect, enter
    in the command line: source /etc/profile


5. Check
    1. Enter echo $PATH in the command line to view the environment variables you have configured
    2. Enter java -version will show version information
    3, enter javac

six, if you want to uninstall jdk, you can use yum erase java-1.7.0-openjdk

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326243830&siteId=291194637