读书人

在Ubuntu装配SUN Java JDK

发布时间: 2012-07-04 19:33:55 作者: rapoo

在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 ?

读书人网 >操作系统

热点推荐