`
dengyin2000
  • 浏览: 1208275 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

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

分享到:
评论
1 楼 mqqqvpppm 2009-05-17  
你好我初学linux,请问,你的第二步之后,怎么设置JAVA_HOME 为 jdk1.6.
之后装了多个jdk后用 sudo alternatives --config java
切换jdk和你说的第二步中point JAVA_HOME to jdk1.6 有冲突马?比如我在装一个jdk1.4.xxx symbolic link 为jdk1.4,这样我要切换jdk时还需要在指定一次JAVA_HOME吗?

相关推荐

Global site tag (gtag.js) - Google Analytics