Download jdk-7u45-linux-x64.tar.gz
: Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. tar decompression: tar-xzvf jdk-7u45-linux-x64.tar.gz
Usually installed in the/usr/local/directory
3. Configure environment variables:
<span style="white-space:pre"></span>$ vi /etc/profile
<Span style = "white-space: pre"> </span> Add:
<span style="white-space:pre"></span>#set java environmentexport JAVA_HOME=/usr/local/jdk1.7.0_45export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/libexport PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
</Pre> <pre code_snippet_id = "367718" snippet_file_name = "blog_20140528_5_9233168" id = "best-answer-content" class = "reply-text mb10" name = "code" style = ""white-space: pre-wrap; word-wrap: break-word; color: rgb (51, 51, 51); line-height: 22px; background-color: rgb (255,252,246 ); margin-top: 0px; margin-bottom: 10px; padding: 0px; font-family: Arial; zoom: 1; "> 4. Make the configuration take effect:
<span style="white-space:pre"></span>source /etc/profile</span>
</Pre> <pre code_snippet_id = "367718" snippet_file_name = "blog_20140528_8_7204873" id = "best-answer-content" class = "reply-text mb10" name = "code" style = ""white-space: pre-wrap; word-wrap: break-word; color: rgb (51, 51, 51); line-height: 22px; background-color: rgb (255,252,246 ); margin-top: 0px; margin-bottom: 10px; padding: 0px; font-family: Arial; zoom: 1; "> 5. Check whether the installation is successful:
<span style="white-space:pre"></span>java -version
<Span style = "white-space: pre"> </span> If version information is displayed, the installation is successful:
<span style="white-space:pre"></span>java version "1.7.0_45"Java(TM) SE Runtime Environment (build 1.7.0_45-b18)Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)</span>
End.