zoukankan      html  css  js  c++  java
  • Manual installation of Oracle Java JDK on Ubuntu

    In the evening I installed the Oracle Java JDK on Ubuntu Lucid Lynx. Since Oracle Java is no longer available via the default repositories I decided to manually install Java instead of adding a repository and possibly installing an older version. Since I need Java to run programs like Apache Ant, Apache FOP, and Saxon for my work as a freelance Perl programmer I prefer to use the Oracle Java over OpenJDK even though the latter might be a solid alternative for my purposes.

    Downloading the Oracle Java JDK
    In order to download the Standard Edition (SE) of the Oracle Java JDK first I clicked on the red "Download" button under the JDK heading on the Java SE Downloads page. This opened another page in my browser with a table of files with above it a "Accept License Agreement" box. I clicked the radio button in front of "Accept" and clicked the now bold jdk-6u26-linux-i586.bin link after "Linux x86 - Self Extracting Installer" entry in the table.

    Installing the JDK
    When the download had finished I moved the downloaded file to /usr/local/java, made it executable, ran it, and deleted it as follows:

    sudo mkdir -p /usr/local/java
    sudo mv /home/john/Downloads/jdk-6u26-linux-x64.bin /usr/local/java
    cd /usr/local/java
    sudo chmod 700 jdk-6u26-linux-x64.bin
    sudo ./jdk-6u26-linux-x64.bin
    sudo rm jdk-6u26-linux-x64.bin
    sudo ln -s jdk1.6.0_26 /usr/local/java/latest
    The installer tried to open a browser window. However, this failed, I guess because of Firefox running as a normal user.

    Now, with the Java SE Development Kit 6 update 26 installed I only needed to add two variables to /etc/environment and extend the PATH variable. Notice that in the previous step I created a symbolic link named latest. When a newer JDK version comes out I only have to update this symbolic link since I refer to latest in /etc/environemnt:

    JAVA_HOME="/usr/local/java/latest"
    JRE_HOME="/usr/local/java/latest/jre"
    PATH="/usr/local/java/latest/bin:
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
    I used sudo vi /etc/environment and changed the file until it was equal to the above four lines. Make sure that nothing follows after the backslash except a newline. If you put accidentally a space after the backslash you might not be able to login later on. Also note that variable interpolation as used in shell scripts does not work.

    I made that mistake and ended up with no longer being able to login. This was easy fixed by booting from a live CD and editing /etc/enviroment.

    If you don't want to log out and log back in to have the updated /etc/environment read in just type:

    source /etc/environment
    After this you should be able to verify the version of both the java and javac program:

    java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
    javac -version
    javac 1.6.0_26
    Important: installing OpenJDK at a later stage along with Oracle Java JDK might result in hard to track issues.

    from:http://johnbokma.com/mexit/2011/06/24/oracle-java-jdk-installation-ubuntu.html

  • 相关阅读:
    如何自动生成参考文献格式
    VS2010+OpenCV 项目生成EXE文件如何在其他电脑上直接运行
    从多核CPU Cache一致性的应用到分布式系统一致性的概念迁移
    【译】为什么永远都不要使用MongoDB Why You Should Never Use MongoDB
    团队技能提升的二三事儿
    从微信朋友圈的评论可见性,谈因果一致性在分布式系统中的应用
    我所认为的软件可靠性的三重境界
    Redis核心原理与实践--事务实践与源码分析
    Redis核心原理与实践--Redis启动过程源码分析
    选择SaaS平台的那些事
  • 原文地址:https://www.cnblogs.com/gaodong/p/3321162.html
Copyright © 2011-2022 走看看