Question: How to Install Oracle Java JDK 8 in Ubuntu 16.04?

Ads

 
 
 

Share on Google+Share on Google+

Java Coder
How to Install Oracle Java JDK 8 in Ubuntu 16.04?
3 Answer(s)      8 months ago
Posted in : Linux

Hi,

Let's know the commands to install Oracle Java 8 on Ubuntu 16.04. How I can install Oracle Java 8?

How to Install Oracle Java JDK 8 in Ubuntu 16.04?

Thanks

Ads
View Answers

August 1, 2016 at 8:30 AM


Hi,

How to Install Oracle Java JDK 8 in Ubuntu 16.04?

Here are the steps to install Oracle Java 8:

Step 1: add java 8 repository with following command:

sudo add-apt-repository ppa:webupd8team/java

Step 2: run update with following command:

sudo apt-get update

Step 3: Now install Java 8 with following command:

sudo apt-get install oracle-java8-installer

sudo apt-get install oracle-java8-set-default

Now you can chek the version of java with following command:

java -version

Here is version details:

[email protected]:/home/deepak# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
[email protected]:/home/deepak#

Thanks



August 1, 2016 at 8:31 AM


Hi,

Here is full log of installation:

[email protected]:/home/deepak# 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 (it should be released in 2016)! 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/tmpd81edhpo/secring.gpg' created
gpg: keyring `/tmp/tmpd81edhpo/pubring.gpg' created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpd81edhpo/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)
OK
[email protected]:/home/deepak# sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release                     
Hit:4 http://in.archive.ubuntu.com/ubuntu xenial InRelease                     
Get:5 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease [17.6 kB]
Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease              
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]   
Get:8 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main amd64 Packages [2,840 B]
Hit:9 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease           
Get:10 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main i386 Packages [2,840 B]
Get:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main Translation-en [1,260 B]
Fetched 120 kB in 2s (55.2 kB/s)                           
Reading package lists... Done
[email protected]:/home/deepak# sudo apt-get install oracle-java8-installerReading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gsfonts-x11 java-common
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 java-common oracle-java8-installer
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 38.6 kB of archives.
After this operation, 227 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 amd64 java-common all 0.56ubuntu2 [7,742 B]
Get:2 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main amd64 oracle-java8-installer all 8u101+8u101arm-1~webupd8~2 [23.6 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 gsfonts-x11 all 0.24 [7,314 B]
Fetched 38.6 kB in 1s (34.4 kB/s)                                              
Preconfiguring packages ...
Selecting previously unselected package java-common.
(Reading database ... 175121 files and directories currently installed.)
Preparing to unpack .../java-common_0.56ubuntu2_all.deb ...
Unpacking java-common (0.56ubuntu2) ...
Selecting previously unselected package oracle-java8-installer.
Preparing to unpack .../oracle-java8-installer_8u101+8u101arm-1~webupd8~2_all.deb ...
Unpacking oracle-java8-installer (8u101+8u101arm-1~webupd8~2) ...
Selecting previously unselected package gsfonts-x11.
Preparing to unpack .../gsfonts-x11_0.24_all.deb ...
Unpacking gsfonts-x11 (0.24) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160701-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
Processing triggers for fontconfig (2.11.94-0ubuntu1) ...
Setting up java-common (0.56ubuntu2) ...
Setting up oracle-java8-installer (8u101+8u101arm-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...
--2016-08-01 18:32:16--  http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 203.116.74.202, 203.116.74.210
Connecting to download.oracle.com (download.oracle.com)|203.116.74.202|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz [following]
--2016-08-01 18:32:17--  https://edelivery.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 125.252.228.12
Connecting to edelivery.oracle.com (edelivery.oracle.com)|125.252.228.12|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/osdc-otn/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz [following]
--2016-08-01 18:32:18--  https://edelivery.oracle.com/osdc-otn/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz
Reusing existing connection to edelivery.oracle.com:443.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz?AuthParam=1470056672_1ef8d7262ed4113bc76d8d17c2f50500 [following]
--2016-08-01 18:32:18--  http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz?AuthParam=1470056672_1ef8d7262ed4113bc76d8d17c2f50500
Connecting to download.oracle.com (download.oracle.com)|203.116.74.202|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 181352138 (173M) [application/x-gzip]
Saving to: ?jdk-8u101-linux-x64.tar.gz?

     0K ........ ........ ........ ........ ........ ........  1% 6.14M 28s
  3072K ........ ........ ........ ........ ........ ........  3% 6.42M 27s
  6144K ........ ........ ........ ........ ........ ........  5% 6.61M 26s
  9216K ........ ........ ........ ........ ........ ........  6% 5.35M 26s
 12288K ........ ........ ........ ........ ........ ........  8% 5.17M 27s
 15360K ........ ........ ........ ........ ........ ........ 10% 6.16M 26s
 18432K ........ ........ ........ ........ ........ ........ 12% 6.21M 25s
 21504K ........ ........ ........ ........ ........ ........ 13% 5.29M 25s
 24576K ........ ........ ........ ........ ........ ........ 15% 6.98M 24s
 27648K ........ ........ ........ ........ ........ ........ 17% 5.03M 24s
 30720K ........ ........ ........ ........ ........ ........ 19% 3.53M 25s
 33792K ........ ........ ........ ........ ........ ........ 20% 5.58M 25s
 36864K ........ ........ ........ ........ ........ ........ 22% 5.86M 24s
 39936K ........ ........ ........ ........ ........ ........ 24% 6.06M 23s
 43008K ........ ........ ........ ........ ........ ........ 26% 4.95M 23s
 46080K ........ ........ ........ ........ ........ ........ 27% 4.87M 23s
 49152K ........ ........ ........ ........ ........ ........ 29% 1.30M 26s
 52224K ........ ........ ........ ........ ........ ........ 31% 5.65M 25s
 55296K ........ ........ ........ ........ ........ ........ 32% 6.39M 24s
 58368K ........ ........ ........ ........ ........ ........ 34% 4.38M 24s
 61440K ........ ........ ........ ........ ........ ........ 36% 5.25M 23s
 64512K ........ ........ ........ ........ ........ ........ 38% 6.18M 22s
 67584K ........ ........ ........ ........ ........ ........ 39% 5.29M 22s
 70656K ........ ........ ........ ........ ........ ........ 41% 5.15M 21s
 73728K ........ ........ ........ ........ ........ ........ 43% 5.52M 20s
 76800K ........ ........ ........ ........ ........ ........ 45% 7.26M 19s
 79872K ........ ........ ........ ........ ........ ........ 46% 4.31M 19s
 82944K ........ ........ ........ ........ ........ ........ 48% 5.78M 18s
 86016K ........ ........ ........ ........ ........ ........ 50% 5.82M 17s
 89088K ........ ........ ........ ........ ........ ........ 52% 5.40M 17s
 92160K ........ ........ ........ ........ ........ ........ 53% 6.31M 16s
 95232K ........ ........ ........ ........ ........ ........ 55% 5.25M 15s
 98304K ........ ........ ........ ........ ........ ........ 57% 5.95M 15s
101376K ........ ........ ........ ........ ........ ........ 58% 5.01M 14s
104448K ........ ........ ........ ........ ........ ........ 60% 6.17M 13s
107520K ........ ........ ........ ........ ........ ........ 62% 5.19M 13s
110592K ........ ........ ........ ........ ........ ........ 64% 6.17M 12s
113664K ........ ........ ........ ........ ........ ........ 65% 5.48M 12s
116736K ........ ........ ........ ........ ........ ........ 67% 3.80M 11s
119808K ........ ........ ........ ........ ........ ........ 69% 5.55M 10s
122880K ........ ........ ........ ........ ........ ........ 71% 4.89M 10s
125952K ........ ........ ........ ........ ........ ........ 72% 5.59M 9s
129024K ........ ........ ........ ........ ........ ........ 74% 6.40M 9s
132096K ........ ........ ........ ........ ........ ........ 76% 3.46M 8s
135168K ........ ........ ........ ........ ........ ........ 78% 5.99M 8s
138240K ........ ........ ........ ........ ........ ........ 79% 4.14M 7s
141312K ........ ........ ........ ........ ........ ........ 81% 5.69M 6s
144384K ........ ........ ........ ........ ........ ........ 83% 5.14M 6s
147456K ........ ........ ........ ........ ........ ........ 84%  879K 6s
150528K ........ ........ ........ ........ ........ ........ 86% 5.83M 5s
153600K ........ ........ ........ ........ ........ ........ 88% 5.08M 4s
156672K ........ ........ ........ ........ ........ ........ 90% 4.71M 4s
159744K ........ ........ ........ ........ ........ ........ 91% 5.14M 3s
162816K ........ ........ ........ ........ ........ ........ 93% 4.69M 2s
165888K ........ ........ ........ ........ ........ ........ 95% 1.42M 2s
168960K ........ ........ ........ ........ ........ ........ 97% 5.00M 1s
172032K ........ ........ ........ ........ ........ ........ 98% 4.14M 0s
175104K ........ ........ ........ .......                   100% 5.37M=39s

2016-08-01 18:32:57 (4.45 MB/s) - ?jdk-8u101-linux-x64.tar.gz? saved [181352138/181352138]

Download done.
Removing outdated cached downloads...
update-alternatives: error: no alternatives for java
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/jcontrol to provide /usr/bin/jcontrol (jcontrol) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javafxpackager to provide /usr/bin/javafxpackager (javafxpackager) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javah to provide /usr/bin/javah (javah) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javap to provide /usr/bin/javap (javap) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javapackager to provide /usr/bin/javapackager (javapackager) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jmc to provide /usr/bin/jmc (jmc) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jps to provide /usr/bin/jps (jps) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jvisualvm to provide /usr/bin/jvisualvm (jvisualvm) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
Oracle JDK 8 installed
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode
Oracle JRE 8 browser plugin installed
Setting up gsfonts-x11 (0.24) ...
[email protected]:/home/deepak# java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32      use a 32-bit data model if available
    -d64      use a 64-bit data model if available
    -server   to select the "server" VM
                  The default VM is server.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
[email protected]:/home/deepak# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
[email protected]:/home/deepak#

Thanks



August 2, 2016 at 11:57 PM


Check following video:

Thanks


Ads









Ads

 
Advertisement null

Ads