在linux系统中安装最新版的jdk

  • 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替换。

你可能感兴趣的:(java,jdk,linux,ubuntu,sun)