- Download the installation package @ http://java.sun.com , we choose the Linux package (not RPM though) to download.
- Copy and execute the downloaded .bin file
sudo cp jdk-6u6-linux-i586.bin /opt # We are going to install the package under /opt cd /opt sudo ./jdk-6u6-linux-i586.bin # Click space button to read through the license agreement, and input "yes" when being prompted.
- Make a symbolic link to make the life easier in the future
sudo ln -s ./jdk1.6.0_06/ ./jdk1.6 # From now on, you can point the JAVA_HOME to /opt/jdk1.6
- Put Java into system alternatives:
sudo alternatives --install /usr/bin/java java /opt/jdk1.6/bin/java 1 sudo alternatives --config java # You would see the following screen: There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /opt/jdk1.6/bin/java Enter to keep the current selection[+], or type selection number: # We don't have other options, so just select 1.
注意的一点是在ubuntu中alternatives用update-alternatives替换。
本文详细介绍了如何在Ubuntu系统中下载并安装Java。包括选择正确的Linux安装包、使用命令行进行安装、设置环境变量以及配置Java为系统默认版本。

851

被折叠的 条评论
为什么被折叠?



