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

  • 相关阅读:
    TreeSet里面放对象,如果同时放入了父类和子类的实例对象,那比较时使用的是父类的compareTo方法,还是使用的子类的compareTo方法,还是抛异常?
    当一个线程进入一个对象的一个synchronized方法后,其它线程是否可进入此对象的其它方法?
    @Qualifier 注解?
    Set里的元素是不能重复的,那么用什么方法来区分重复与否呢?是用==还是equals()?它们有何区别?
    Filter是什么?有什么作用?
    List和 Map区别?
    Spring框架的事务管理有哪些优点?
    Listener是什么?有什么作用?
    字节流与字符流的区别?
    Struts2里面有什么隐式对象?
  • 原文地址:https://www.cnblogs.com/gaodong/p/3321162.html
Copyright © 2011-2022 走看看