首页 > 系统 > Ubuntu > 正文

ubuntu13.04下安装jdk7

2024-06-28 13:28:08
字体:
来源:转载
供稿:网友
Ubuntu13.04下安装jdk7参考http://www.neversaydie.cc/ubuntu-install-jdk-in-detailed/?而来

1.手工从Oralce官网下载jdk-7u25-linux-x64.gz?然后mv?jdk-7u25-linux-x64.gz?/usr/local/devtools

2.解压?tar?zxvf?jdk-7u25-linux-x64.gz

3.设置环境变量

vim /etc/PRofile

按a进入编辑模式,在文件最后输入

#set java environment

  1. export?JAVA_HOME=/usr/local/devtools/jdk1.7.0_25??
  2. export?CLASSPATH=.:${JAVA_HOME}/lib:$CLASSPATH
  3. export?PATH=${JAVA_HOME}/bin:$PATH
  4. 按ESC退出编辑模式,输入:wq
PS:看到有好多人设置了JRE_HOME,个人认为没有必要 使命令生效 source?/etc/profile 4.再次设置环境变量vim /etc/bash.bashrc

?

按a进入编辑模式,在文件最后输入

#set java environment

  1. export?JAVA_HOME=/usr/local/devtools/jdk1.7.0_25??
  2. export?CLASSPATH=.:${JAVA_HOME}/lib:$CLASSPATH
  3. export?PATH=${JAVA_HOME}/bin:$PATH
  4. 按ESC退出编辑模式,输入:wq
使命令生效 source?/etc/bash.bashrc 5.如果ubuntu可能还会有默认的jdk,如openjdk;为了使默认使用的是我们安装的jdk,还需执行如下命令:
  1. sudo?update-alternatives?--install?/usr/bin/java?java?/usr/local/devtools/jdk1.7.0_25/bin/java?300
  2. sudo?update-alternatives?--install?/usr/bin/javac?javac?/usr/local/devtools/jdk1.7.0_25/bin/javac?300
  3. sudo?update-alternatives?--install?/usr/bin/jar?jar?/usr/local/devtools/jdk1.7.0_25/bin/jar?300
  4. sudo?update-alternatives?--install?/usr/bin/javah?javah?/usr/local/devtools/jdk1.7.0_25/bin/javah?300
  5. sudo?update-alternatives?--install?/usr/bin/javap?javap?/usr/local/devtools/jdk1.7.0_25/bin/javap?300
sudo?update-alternatives?--config?java 6.验证安装是否成功java -version出现一下信息则说明成功了java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

?


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表