Wednesday 26 April 2017

Installation of JRE/JDK in Ubuntu 16.04


Installing and Managing versions of Java 

 #1  sudo -s

sudo is short for 'superuser do' meaning 'execute the following command as the superuser'. Thus, it grants the humble user root privileges for one command and any commands triggered by that command.However, Ubuntu does not include the root user. Instead, administrative access is given to individual users, who may use the "sudo" application to perform administrative tasks. The first user account you created on your system during installation will, by default, have access to sudo

#mayank@mayank-VirtualBox:~$ sudo -s
#root@mayank-VirtualBox:~# 

#2 sudo apt-get update
#root@mayank-VirtualBox:~# sudo apt-get update

Hit:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 306 kB in 5s (54.8 kB/s)
Reading package lists... Done

#3 Check for Java already installed:  java -version
#root@mayank-VirtualBox:~# java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.9-jre-headless
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* openjdk-9-jre-headless
Try: apt install <selected package>

The program java can be found in the following packages", Java hasn't been installed

#root@mayank-VirtualBox:~# sudo apt-get install default-jre

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates-java default-jre-headless fonts-dejavu-extra java-common
libbonobo2-0 libbonobo2-common libgif7 libgnome-2-0 libgnome2-common
libgnomevfs2-0 libgnomevfs2-common liborbit-2-0 openjdk-8-jre
openjdk-8-jre-headless
Suggested packages:...

Will install the Java Runtime Environment-JRE. If you instead need the Java Development Kit -JDK, which is needed to compile Java applications


#root@mayank-VirtualBox:~# sudo apt-get install default-jdk

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
default-jdk-headless libice-dev libpthread-stubs0-dev libsm-dev libx11-dev
libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk
openjdk-8-jdk-headless x11proto-core-dev x11proto-input-dev x11proto-kb-dev
xorg-sgml-doctools xtrans-dev
Suggested packages:
libice-doc libsm-doc libxcb-doc libxt-doc openjdk-8-demo openjdk-8-source visualvm
The following NEW packages will be installed:
default-jdk default-jdk-headless libice-dev libpthread-stubs0-dev libsm-dev
libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk
openjdk-8-jdk-headless x11proto-core-dev x11proto-input-dev x11proto-kb-dev
xorg-sgml-doctools xtrans-dev
0 upgraded, 18 newly installed, 0 to remove and 449 not upgraded.
Need to get 12.0 MB of archives.
After this operation, 57.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...




#root@mayank-VirtualBox:~# sudo apt-get install python-software-properties

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python-apt python-pycurl
Suggested packages:
python-apt-dbg python-apt-doc libcurl4-gnutls-dev python-pycurl-dbg
python-pycurl-doc
The following NEW packages will be installed:
python-apt python-pycurl python-software-properties
0 upgraded, 3 newly installed, 0 to remove and 449 not upgraded.
Need to get 206 kB of archives.
After this operation, 896 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main i386 python-apt i386 1.1.0~beta1build1 [141 kB]
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main i386 python-apt i386 1.1.0~beta1build1 [141 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial/main i386 python-pycurl i386 7.43.0-1ubuntu1 [45.1 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe i386 python-software-properties all 0.96.20.5 [20.3 kB]
Fetched 206 kB in 1s (132 kB/s)
Selecting previously unselected package python-apt.
(Reading database ... 174418 files and directories currently installed.)
Preparing to unpack .../python-apt_1.1.0~beta1build1_i386.deb ...
Unpacking python-apt (1.1.0~beta1build1) ...
Selecting previously unselected package python-pycurl.
Preparing to unpack .../python-pycurl_7.43.0-1ubuntu1_i386.deb ...
Unpacking python-pycurl (7.43.0-1ubuntu1) ...
Selecting previously unselected package python-software-properties.
Preparing to unpack .../python-software-properties_0.96.20.5_all.deb ...
Unpacking python-software-properties (0.96.20.5) ...
Setting up python-apt (1.1.0~beta1build1) ...
Setting up python-pycurl (7.43.0-1ubuntu1) ...
Setting up python-software-properties (0.96.20.5) ...




#root@mayank-VirtualBox:~# sudo add-apt-repository ppa:webupd8team/java

Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.
More info (and Ubuntu installation instructions):
- for Oracle Java 7: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
- for Oracle Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html
Debian installation instructions:
- Oracle Java 7: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
- Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
Oracle Java 9 (for both Ubuntu and Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html
For JDK9, the PPA uses standard builds from: https://jdk9.java.net/download/ (and not the Jigsaw builds!).
Important!!! For now, you should continue to use Java 8 because Oracle Java 9 is available as an early access release! You should only use Oracle Java 9 if you explicitly need it, because it may contain bugs and it might not include the latest security patches! Also, some Java options were removed in JDK9, so you may encounter issues with various Java apps. More information and installation instructions (Ubuntu / Linux Mint / Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html
More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmp31cg0nvp/secring.gpg' created
gpg: keyring `/tmp/tmp31cg0nvp/pubring.gpg' created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp31cg0nvp/trustdb.gpg: trustdb created
gpg: key EEA14886: public key "Launchpad VLC" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)



#sudo apt-get update

#root@mayank-VirtualBox:~# sudo apt-get update

Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease [17.6 kB]
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:6 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main i386 Packages [2,864 B]
Get:7 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main Translation-en [1,260 B]
Fetched 328 kB in 6s (53.4 kB/s)
Reading package lists... Done




JDK 7
The Latest Stable Version.
#sudo apt-get install oracle-java7-installer
root@mayank-VirtualBox:~# sudo apt-get install oracle-java7-installer

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
gsfonts-x11
Suggested packages:
binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic
| ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
gsfonts-x11 oracle-java7-installer
0 upgraded, 2 newly installed, 0 to remove and 449 not upgraded.
Need to get 29.7 kB of archives.
After this operation, 225 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe i386 gsfonts-x11 all 0.24 [7,314 B]
Get:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main i386 oracle-java7-installer all 7u80+7u60arm-0~webupd8~1 [22.4 kB]
Fetched 29.7 kB in 0s (48.4 kB/s)
Preconfiguring packages ...
Selecting previously unselected package oracle-java7-installer.
(Reading database ... 174470 files and directories currently installed.)
Preparing to unpack .../oracle-java7-installer_7u80+7u60arm-0~webupd8~1_all.deb ...
Unpacking oracle-java7-installer (7u80+7u60arm-0~webupd8~1) ...
Selecting previously unselected package gsfonts-x11.
Preparing to unpack .../gsfonts-x11_0.24_all.deb ...
Unpacking gsfonts-x11 (0.24) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160415-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2) ...
Processing triggers for fontconfig (2.11.94-0ubuntu1) ...
Setting up oracle-java7-installer (7u80+7u60arm-0~webupd8~1) ...
Downloading Oracle Java 7...
--2017-04-14 17:35:58-- http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-i586.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.32.28.209, 23.32.28.200
Connecting to download.oracle.com (download.oracle.com)|23.32.28.209|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-i586.tar.gz [following]
--2017-04-14 17:36:02-- https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-i586.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.120.92.211, 2600:140f:5:184::2d3e, 2600:140f:5:182::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.120.92.211|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-i586.tar.gz?AuthParam=1492171684_bd84ed58cd1a587fe488781285ce4611 [following]
--2017-04-14 17:36:04-- http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-i586.tar.gz?AuthParam=1492171684_bd84ed58cd1a587fe488781285ce4611
Connecting to download.oracle.com (download.oracle.com)|23.32.28.209|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 154850445 (148M) [application/x-gzip]
Saving to: ‘jdk-7u80-linux-i586.tar.gz’

0K ........ ........ ........ ........ ........ ........ 2% 627K 3m56s                3072K ........ ........ ........ ........ ........ ........ 4% 692K 3m41s
6144K ........ ........ ........ ........ ........ ........ 6% 578K 3m46s          9216K ........ ........ ........ ........ ........ ........ 8% 679K 3m37s
12288K ........ ........ ........ ........ ........ ........ 10% 605K 3m35s      15360K ........ ........ ........ ........ ........ ........ 12% 590K 3m32s
18432K ........ ........ ........ ........ ........ ........ 14% 591K 3m29s      21504K ........ ........ ........ ........ ........ ........ 16% 695K 3m21s
24576K ........ ........ ........ ........ ........ ........ 18% 702K 3m14s      27648K ........ ........ ........ ........ ........ ........ 20% 707K 3m8s
30720K ........ ........ ........ ........ ........ ........ 22% 708K 3m1s        33792K ........ ........ ........ ........ ........ ........ 24% 598K 2m58s
36864K ........ ........ ........ ........ ........ ........ 26% 624K 2m53s      39936K ........ ........ ........ ........ ........ ........ 28% 701K 2m48s
43008K ........ ........ ........ ........ ........ ........ 30% 444K 2m48s      46080K ........ ........ ........ ........ ........ ........ 32% 354K 2m51s
49152K ........ ........ ........ ........ ........ ........ 34% 473K 2m48s      52224K ........ ........ ........ ........ ........ ........ 36% 511K 2m44s
55296K ........ ........ ........ ........ ........ ........ 38% 559K 2m39s      58368K ........ ........ ........ ........ ........ ........ 40% 552K 2m35s
61440K ........ ........ ........ ........ ........ ........ 42% 569K 2m29s      64512K ........ ........ ........ ........ ........ ........ 44% 672K 2m23s
67584K ........ ........ ........ ........ ........ ........ 46% 700K 2m17s      70656K ........ ........ ........ ........ ........ ........ 48% 714K 2m11s
73728K ........ ........ ........ ........ ........ ........ 50% 638K 2m5s        76800K ........ ........ ........ ........ ........ ........ 52% 681K 1m59s
79872K ........ ........ ........ ........ ........ ........ 54% 659K 1m54s      82944K ........ ........ ........ ........ ........ ........ 56% 703K 1m48s
86016K ........ ........ ........ ........ ........ ........ 58% 708K 1m43s      89088K ........ ........ ........ ........ ........ ........ 60% 713K 97s
92160K ........ ........ ........ ........ ........ ........ 62% 709K 92s            95232K ........ ........ ........ ........ ........ ........ 65% 661K 86s
98304K ........ ........ ........ ........ ........ ........ 67% 711K 81s            101376K ........ ........ ........ ........ ........ ........ 69% 712K 76s
104448K ........ ........ ........ ........ ........ ........ 71% 628K 71s          107520K ........ ........ ........ ........ ........ ........ 73% 647K 66s
110592K ........ ........ ........ ........ ........ ........ 75% 699K 60s          113664K ........ ........ ........ ........ ........ ........ 77% 635K 56s
116736K ........ ........ ........ ........ ........ ........ 79% 650K 51s          119808K ........ ........ ........ ........ ........ ........ 81% 677K 45s
122880K ........ ........ ........ ........ ........ ........ 83% 697K 40s          125952K ........ ........ ........ ........ ........ ........ 85% 616K 36s
129024K ........ ........ ........ ........ ........ ........ 87% 665K 31s          132096K ........ ........ ........ ........ ........ ........ 89% 713K 26s
135168K ........ ........ ........ ........ ........ ........ 91% 129K 22s          138240K ........ ........ ........ ........ ........ ........ 93% 597K 17s
141312K ........ ........ ........ ........ ........ ........ 95% 711K 12s          144384K ........ ........ ........ ........ ........ ........ 97% 697K 6s
147456K ........ ........ ........ ........ ........ ........ 99% 661K 1s            150528K ........ .. 100% 654K=4m19s

2017-04-14 17:40:24 (584 KB/s) - ‘jdk-7u80-linux-i586.tar.gz’ saved [154850445/154850445]
Download done.
Removing outdated cached downloads...
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/java_vm to provide /usr/bin/java_vm (java_vm) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/jcontrol to provide /usr/bin/jcontrol (jcontrol) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/javafxpackager to provide /usr/bin/javafxpackager (javafxpackager) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/javah to provide /usr/bin/javah (javah) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/javap to provide /usr/bin/javap (javap) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jmc to provide /usr/bin/jmc (jmc) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jps to provide /usr/bin/jps (jps) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/jvisualvm to provide /usr/bin/jvisualvm (jvisualvm) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
Oracle JDK 7 installed
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/lib/i386/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode
Oracle JRE 7 browser plugin installed
Setting up gsfonts-x11 (0.24) ...

JDK 8
#sudo apt-get install oracle-java8-installer
#root@mayank-VirtualBox:~# sudo apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  oracle-java8-set-default
Suggested packages:
  binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic
  | ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
  oracle-java8-installer oracle-java8-set-default
0 upgraded, 2 newly installed, 0 to remove and 449 not upgraded.
Need to get 39.5 kB of archives.
After this operation, 138 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main i386 oracle-java8-installer all 8u121-1~webupd8~2 [32.9 kB]
Get:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main i386 oracle-java8-set-default all 8u121-1~webupd8~2 [6,612 B]
Fetched 39.5 kB in 0s (41.2 kB/s)              
Preconfiguring packages ...
Selecting previously unselected package oracle-java8-installer.
(Reading database ... 174535 files and directories currently installed.)
Preparing to unpack .../oracle-java8-installer_8u121-1~webupd8~2_all.deb ...
oracle-license-v1-1 license has already been accepted
Unpacking oracle-java8-installer (8u121-1~webupd8~2) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160415-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up oracle-java8-installer (8u121-1~webupd8~2) ...
No /var/cache/oracle-jdk8-installer/wgetrc file found.
Creating /var/cache/oracle-jdk8-installer/wgetrc and
using default oracle-java8-installer wgetrc settings for it.
Downloading Oracle Java 8...
--2017-04-14 17:44:54--  http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.32.28.200, 23.32.28.209
Connecting to download.oracle.com (download.oracle.com)|23.32.28.200|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz [following]
--2017-04-14 17:44:54--  https://edelivery.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.120.92.211, 2600:140f:5:184::2d3e, 2600:140f:5:182::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.120.92.211|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz?AuthParam=1492172214_feb365fa6f803b13540afb817b563cca [following]
--2017-04-14 17:44:55--  http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz?AuthParam=1492172214_feb365fa6f803b13540afb817b563cca
Connecting to download.oracle.com (download.oracle.com)|23.32.28.200|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 185735871 (177M) [application/x-gzip]
Saving to: ‘jdk-8u121-linux-i586.tar.gz’

     0K ........ ........ ........ ........ ........ ........  1%  710K 4m11s   3072K ........ ........ ........ ........ ........ ........  3%  500K 4m59s
  6144K ........ ........ ........ ........ ........ ........  5%  701K 4m37s   9216K ........ ........ ........ ........ ........ ........  6%  629K 4m32s
 12288K ........ ........ ........ ........ ........ ........  8%  571K 4m31s   15360K ........ ........ ........ ........ ........ ........ 10%  709K 4m20s
 18432K ........ ........ ........ ........ ........ ........ 11%  700K 4m12s   21504K ........ ........ ........ ........ ........ ........ 13%  710K 4m4s
 24576K ........ ........ ........ ........ ........ ........ 15%  706K 3m56s   27648K ........ ........ ........ ........ ........ ........ 16%  713K 3m50s
 30720K ........ ........ ........ ........ ........ ........ 18%  701K 3m44s   33792K ........ ........ ........ ........ ........ ........ 20%  638K 3m40s
 36864K ........ ........ ........ ........ ........ ........ 22%  678K 3m34s   39936K ........ ........ ........ ........ ........ ........ 23%  678K 3m29s
 43008K ........ ........ ........ ........ ........ ........ 25%  653K 3m25s   46080K ........ ........ ........ ........ ........ ........ 27%  645K 3m21s
 49152K ........ ........ ........ ........ ........ ........ 28%  600K 3m17s   52224K ........ ........ ........ ........ ........ ........ 30%  674K 3m12s
 55296K ........ ........ ........ ........ ........ ........ 32%  660K 3m7s    58368K ........ ........ ........ ........ ........ ........ 33%  604K 3m3s
 61440K ........ ........ ........ ........ ........ ........ 35%  712K 2m58s   64512K ........ ........ ........ ........ ........ ........ 37%  689K 2m53s
 67584K ........ ........ ........ ........ ........ ........ 38%  661K 2m48s   70656K ........ ........ ........ ........ ........ ........ 40%  674K 2m43s
 73728K ........ ........ ........ ........ ........ ........ 42%  663K 2m39s   76800K ........ ........ ........ ........ ........ ........ 44%  620K 2m34s
 79872K ........ ........ ........ ........ ........ ........ 45%  613K 2m30s   82944K ........ ........ ........ ........ ........ ........ 47%  589K 2m26s
 86016K ........ ........ ........ ........ ........ ........ 49%  587K 2m22s   89088K ........ ........ ........ ........ ........ ........ 50%  638K 2m17s
 92160K ........ ........ ........ ........ ........ ........ 52%  596K 2m13s   95232K ........ ........ ........ ........ ........ ........ 54%  642K 2m8s
 98304K ........ ........ ........ ........ ........ ........ 55%  614K 2m4s    101376K ........ ........ ........ ........ ........ ........ 57%  546K 2m0s
104448K ........ ........ ........ ........ ........ ........ 59%  648K 1m55s   107520K ........ ........ ........ ........ ........ ........ 60%  602K 1m50s
110592K ........ ........ ........ ........ ........ ........ 62%  654K 1m45s     113664K ........ ........ ........ ........ ........ ........ 64%  523K 1m41s
116736K ........ ........ ........ ........ ........ ........ 66%  643K 96s         119808K ........ ........ ........ ........ ........ ........ 67%  435K 93s
122880K ........ ........ ........ ........ ........ ........ 69%  633K 88s         125952K ........ ........ ........ ........ ........ ........ 71%  614K 83s
129024K ........ ........ ........ ........ ........ ........ 72%  654K 78s         132096K ........ ........ ........ ........ ........ ........ 74%  641K 73s
135168K ........ ........ ........ ........ ........ ........ 76%  576K 68s         138240K ........ ........ ........ ........ ........ ........ 77%  615K 64s
141312K ........ ........ ........ ........ ........ ........ 79%  580K 59s         144384K ........ ........ ........ ........ ........ ........ 81%  583K 54s
147456K ........ ........ ........ ........ ........ ........ 82%  599K 49s         150528K ........ ........ ........ ........ ........ ........ 84%  603K 44s
153600K ........ ........ ........ ........ ........ ........ 86%  583K 39s         156672K ........ ........ ........ ........ ........ ........ 88%  637K 35s
159744K ........ ........ ........ ........ ........ ........ 89%  578K 30s         162816K ........ ........ ........ ........ ........ ........ 91%  640K 25s
165888K ........ ........ ........ ........ ........ ........ 93%  617K 20s         168960K ........ ........ ........ ........ ........ ........ 94%  648K 15s
172032K ........ ........ ........ ........ ........ ........ 96%  629K 10s         175104K ........ ........ ........ ........ ........ ........ 98%  591K 5s
178176K ........ ........ ........ ........ ........ ........ 99%  571K 0s           181248K ..                                                   100%  709K=4m51s
2017-04-14 17:49:46 (624 KB/s) - ‘jdk-8u121-linux-i586.tar.gz’ saved [185735871/185735871]
Download done.
Removing outdated cached downloads...
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javapackager to provide /usr/bin/javapackager (javapackager) in auto mode
Oracle JRE 8 browser plugin installed
Oracle JDK 8 installed
#####Important########
To set Oracle JDK8 as default, install the "oracle-java8-set-default" package.
E.g.: sudo apt install oracle-java8-set-default
On Ubuntu systems, oracle-java8-set-default is most probably installed
automatically with this package.
######################
Selecting previously unselected package oracle-java8-set-default.
(Reading database ... 174563 files and directories currently installed.)
Preparing to unpack .../oracle-java8-set-default_8u121-1~webupd8~2_all.deb ...
Unpacking oracle-java8-set-default (8u121-1~webupd8~2) ...
Setting up oracle-java8-set-default (8u121-1~webupd8~2) ...

Managing Java Version

We have multiple Java installations on your Droplet, the Java version to use as default can be chosen. To do this, execute the following command:
#sudo update-alternatives --config java
It will usually return something like this if you have 2 installations (if you have more, it will of course return more):
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      manual mode
Press enter to keep the current choice[*], or type selection number:
You can now choose the number to use as default. This can also be done for the Java compiler (javac):
#sudo update-alternatives --config javac
This command can be executed for all other commands which have different installations. In Java, this includes but is not limited to: keytool, javadoc and jarsigner.
#root@mayank-VirtualBox:~# sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                           Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-oracle/jre/bin/java         1082      auto mode
  1            /usr/lib/jvm/java-7-oracle/jre/bin/java         1082      manual mode
  2            /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java   1081      manual mode
* 3            /usr/lib/jvm/java-8-oracle/jre/bin/java         1081      manual mode
Press <enter> to keep the current choice[*], or type selection number: 3


/usr/lib/jvm/java-7-oracle
Copy the path from your preferred installation and then edit the file /etc/environment:
sudo nano /etc/environment
In this file, add the following line (replacing YOUR_PATH by the just copied path):
JAVA_HOME="YOUR_PATH"
That should be enough to set the environment variable. Now reload this file:
source /etc/environment
Test it by executing:
echo $JAVA_HOME
If it returns the just set path, the environment variable has been set successfully. If it doesn't, please make sure you followed all steps correctly.
#root@mayank-VirtualBox:~# sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                           Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-oracle/jre/bin/java         1082      auto mode
  1            /usr/lib/jvm/java-7-oracle/jre/bin/java         1082      manual mode
  2            /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java   1081      manual mode
* 3            /usr/lib/jvm/java-8-oracle/jre/bin/java         1081      manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/java to provide /usr/bin/java (java) in manual mode

#root@mayank-VirtualBox:~# sudo nano /etc/environment

#root@mayank-VirtualBox:~# java -version
java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) Client VM (build 24.80-b11, mixed mode)
#root@mayank-VirtualBox:~# source /etc/environment
#root@mayank-VirtualBox:~# echo $JAVA_HOME
/usr/lib/jvm/java-7-oracle

No comments:

Post a Comment