Tech Ubuntu 14.04 update : Install Java JDK in Ubuntu 14.04 : the manual way

 how Install Java JDK in Ubuntu 14.04 : the manual way

There is a similar answer on how to install JRE 8.

Install Java JDK

The manual way

  • Download the 32bit or 64bit Linux "compressed binary file" - it has a ".tar.gz" file extension.

  • Uncompress it

    tar -xvf jdk-8-linux-i586.tar.gz (32bit)

    tar -xvf jdk-8-linux-x64.tar.gz (64bit)

    JDK 8 package is extracted into ./jdk1.8.0 directory. N.B. check carefully this folder name since Oracle seem to change this occasionally with each update.

  • Now move the JDK 8 directory to /usr/lib

    sudo mkdir -p /usr/lib/jvm  sudo mv ./jdk1.8.0 /usr/lib/jvm/  
  • Now run

    sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0/bin/java" 1  sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0/bin/javac" 1  sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0/bin/javaws" 1  

    This will assign Oracle JDK a priority of 1, which means that installing other JDKs will replace it as the default. Be sure to use a higher priority if you want Oracle JDK to remain the default.

  • Correct the file ownership and the permissions of the executables:

    sudo chmod a+x /usr/bin/java   sudo chmod a+x /usr/bin/javac   sudo chmod a+x /usr/bin/javaws  sudo chown -R root:root /usr/lib/jvm/jdk1.8.0  

    N.B. remember - Java JDK has many more executables that you can similarly install as above. java, javac, javaws are probably the most frequently required.
    This answer lists the other executables available.

  • Run

    sudo update-alternatives --config java  

You will see output similar one below - choose the number of jdk1.8.0 - for example 3 in this list (unless you have have never installed Java installed in your computer in which case a sentence saying "There is nothing to configure" will appear):

    $ sudo update-alternatives --config java      There are 3 choices for the alternative java (providing /usr/bin/java).

to enable Mozilla Firefox plugin:
32 bit:  ln -s /usr/lib/jvm/jdk1.8.0/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/    64 bit:  ln -s /usr/lib/jvm/jdk1.8.0/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

N.B. you can link the plugin (libnpjp2.so) to /usr/lib/firefox/plugins/ for a system wide installation, For Ubuntu 13.10 path to plugin directory is /usr/lib/firefox/browser/plugins/

Depending on your configuration, you might need to update the apparmor profile for firefox (or other browsers) in /etc/apparmor.d/abstractions/ubuntu-browsers.d/java



read more and completely at http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre/55960#55960

No comments:

Post a Comment