zoukankan      html  css  js  c++  java
  • JDK安装

    https://help.ubuntu.com/community/Java#Oracle_.28Sun.29_Java_6

    • oracle java 6 jdk 64-bit
     $ wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin
     $ chmod u+x jdk-6u45-linux-x64.bin
     $ ./jdk-6u45-linux-x64.bin
     $ sudo mv jdk1.6.0_45 /opt
     $ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.6.0_45/bin/java" 1
     $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.6.0_45/bin/javac" 1
     $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/opt/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1
     $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk1.6.0_45/bin/javaws"
    • 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

    Optionally you can set a JAVA_HOME env variable:

    export _JAVA_HOME=/opt/jdk1.6.0_45/

     

    Choosing the default Java to use

    If your system has more than one version of Java, configure which one your system uses by entering the following command in a terminal window

    sudo update-alternatives --config java

    This will present you with a selection that looks similar to the following (the details may differ for you):

    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/jre1.7.0/jre/bin/java 3 manual mode  
    
    Press enter to keep the current choice[*], or type selection number: 1

    ALL DONE. You can test your java install by

    java -version

    Here is a small screen capture of what happened on my screen when I went through above steps

    Oracle JDK Install

    Finally if you need to add JAVA_HOME variable, you can do so by adding it to the .bashrc file in your home directory

    Open .bashrc file using an editor. If you use VI then
    vi ~/.bashrc

    and add the following 2 lines in your .bashrc file.

    JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
    export JAVA_HOME

  • 相关阅读:
    在线教育项目-day02【讲师分页功能和多条件组合查询功能】
    在线教育项目-day02【统一结果返回】
    Go语言数组和切片的原理
    Go语言单元测试与基准测试
    PHPWord导出word文档
    Go语言反射reflect
    漫画:什么是HTTPS?
    什么是shell和终端?
    Go接口interface
    Go变量逃逸分析
  • 原文地址:https://www.cnblogs.com/zawn/p/3662363.html
Copyright © 2011-2022 走看看