ubuntu下jdk6的安装

$ sudo apt-get install sun-java6-jdk

 

报错:E: Package 'sun-java6-jdk' has no installation candidate

修改/etc/apt/source.list(其为只读,取消只读用 $ sudo chmod go+w sources.list )

添加deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse ,保存后$ sudo  apt-get update

再试$ sudo apt-get install sun-java6-jdk

安装到configuring sun-java6-jre 时OK点不到,需要按下tab。

如果此时你把页面关了,则你想再进入配置页就要输入:sudo apt-get -f install 这是查询安装的所有依赖包。否则你想install或者reinstall都不行,会报:ia32-sun-java6 gsfonts-x11 Unmet dependencies这些错误。

最后用java -version测试下。

Ubuntu 12.04安装JDK见:

http://www.cnblogs.com/beyonding1983/archive/2012/11/08/2759757.html

https://help.ubuntu.com/community/Java

  • IMPORTANT choose the java you installed as default

 

 $ sudo update-alternatives --config java
 $ sudo update-alternatives --config javac
 $ sudo update-alternatives --config mozilla-javaplugin.so
 $ sudo update-alternatives --config javaws

设置JAVA_HOME:

If you want this environment variable available to all users and on system start then you can add the following to /etc/profile.d/java.sh  (create it if necessary):

export JDK_HOME=/usr/lib/jvm/yourjdk
export JAVA_HOME=/usr/lib/jvm/
yourjdk

Then in a terminal run:

sudo chmod +x /etc/profile.d/java.sh
source /etc/profile.d/java.sh


猜你喜欢

转载自zhangjian1982.iteye.com/blog/1119720