在Ubuntu安装SUN Java JDK

由于某种原因ubuntu 不再支持在命令行下直接安装JAVA, 在网上找了一个方法

 

 

First you need to check that Ubuntu Partners repository is enabled in your apt sources list, open /etc/apt/sources.list and uncomment the following line:

deb http://archive.canonical.com/ubuntu maverick partner
 
Then in command line type
sudo apt-get update
sudo apt-get install sun-java6-jdk
 

As well you need to set Sun Java as default Java provider in your system by typing the following in command line
sudo update-alternatives --config java
 
You will be presented with the screen similar to this one:
写道
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

Press enter to keep the current choice[*], or type selection number: 2
 
Select the option that has the path /usr/lib/jvm/java-6-sun/jre/bin/java and you are done.
to check if you are using the Sun Java provider type the following:
java -version
 
You should see a screen similar to the below
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
 

The better method is editing your .bashrc file and adding the bolded line there. You’ll have to logout of the shell for the change to take effect.
vi ~/.bashrc
 
Add the following line:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值