Install the Java

Just put the Tencent cloud Linux environment, thinking of using Java to write hello world run to search the first method is

yum search jdk
Copy the code

Ensure that version 1.8 is used

Yum install Java -- 1.8.0 comes with its x86_64Copy the code

After the installation is successful, running the Java -version command does not take effect. Environment variables are not configured.

vi /etc/profile
Copy the code

At the end of the file add:

#set Java environment JAVA_HOME=/usr/lib/ jre-1.6.0-openJDk.x86_64 PATH=$PATH:$JAVA_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME CLASSPATH PATHCopy the code

Execute the command to effect the configuration after adding:

. /etc/profile
Copy the code

Notice that there is a space after this and Java is configured

At this point, I found that the installation without javac command, can not achieve the compilation process, so I want to delete the Java and execute

yum remove java
Copy the code

It’s very fast