首页 > 代码库 > linux 安装jdk-7u45-linux-x64.tar.gz

linux 安装jdk-7u45-linux-x64.tar.gz

1、官网下载jdk-7u45-linux-x64.tar.gz

下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


2、tar解压:tar -xzvf jdk-7u45-linux-x64.tar.gz

一般安装在/usr/local/目录下


3、配置环境变量:

<span style="white-space:pre">	</span>$ vi /etc/profile
<span style="white-space:pre">	</span>在尾行添加:
<span style="white-space:pre">	</span>#set java environment
	export JAVA_HOME=/usr/local/jdk1.7.0_45
	export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
	export 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、使配置生效:
<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、检验是否安装成功:
<span style="white-space:pre">	</span>java -version
<span style="white-space:pre">	</span>出现版本信息说明安装成功:
<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>
结束。