Howto install Java 7 JDK JRE on Ubuntu 13.04 12.10 12.04 11.10

Howto install Java 7 JDK JRE on Ubuntu 13.04 12.10 12.04 11.10

ubuntu

1. Install repository for JDK and JRE

root@ip-10-48-234-13:~# sudo add-apt-repository ppa:webupd8team/java
You are about to add the following PPA to your system:
Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK6 / JDK7 / JDK8). There are no actual Java files in this PPA. More info: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
More info: https://launchpad.net/~webupd8team/+archive/java
Press [ENTER] to continue or ctrl-c to cancel adding itgpg: keyring `/tmp/tmpiJSUei/secring.gpg’ created
gpg: keyring `/tmp/tmpiJSUei/pubring.gpg’ created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpiJSUei/trustdb.gpg: trustdb created
gpg: key EEA14886: public key “Launchpad VLC” imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
root@ip-10-48-234-13:~#

2. Update repository on Ubuntu

root@ip-10-48-234-13:~# sudo apt-get update
Ign http://ppa.launchpad.net precise InRelease
Ign http://eu-west-1.ec2.archive.ubuntu.com precise InRelease
Get:1 http://ppa.launchpad.net precise Release.gpg [316 B]
Ign http://eu-west-1.ec2.archive.ubuntu.com precise-updates InRelease
Get:2 http://ppa.launchpad.net precise Release [11.9 kB]
Hit http://eu-west-1.ec2.archive.ubuntu.com precise Release.gpg
Get:3 http://eu-west-1.ec2.archive.ubuntu.com precise-updates Release.gpg [198 B]
Hit http://eu-west-1.ec2.archive.ubuntu.com precise Release
Get:4 http://eu-west-1.ec2.archive.ubuntu.com precise-updates Release [49.6 kB]
Get:5 http://ppa.launchpad.net precise/main Sources [1,003 B]
Get:6 http://ppa.launchpad.net precise/main amd64 Packages [2,504 B]
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/main Sources
Get:7 http://ppa.launchpad.net precise/main i386 Packages [2,504 B]
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/universe Sources
Ign http://security.ubuntu.com precise-security InRelease
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/main amd64 Packages
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/universe amd64 Packages
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/main i386 Packages
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/universe i386 Packages
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/main TranslationIndex
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/universe TranslationIndex
Get:8 http://eu-west-1.ec2.archive.ubuntu.com precise-updates/main Sources [383 kB]
Get:9 http://security.ubuntu.com precise-security Release.gpg [198 B]
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Get:10 http://security.ubuntu.com precise-security Release [49.6 kB]
Get:11 http://eu-west-1.ec2.archive.ubuntu.com precise-updates/universe Sources [86.4 kB]
Get:12 http://eu-west-1.ec2.archive.ubuntu.com precise-updates/main amd64 Packages [609 kB]
Get:13 http://eu-west-1.ec2.archive.ubuntu.com precise-updates/universe amd64 Packages [198 kB]
Get:14 http://eu-west-1.ec2.archive.ubuntu.com precise-updates/main i386 Packages [621 kB]
Get:15 http://security.ubuntu.com precise-security/main Sources [71.8 kB]
Get:16 http://eu-west-1.ec2.archive.ubuntu.com precise-updates/universe i386 Packages [202 kB]
Get:17 http://security.ubuntu.com precise-security/universe Sources [24.0 kB]
Hit http://eu-west-1.ec2.archive.ubuntu.com precise-updates/main TranslationIndex
Hit http://eu-west-1.ec2.archive.ubuntu.com precise-updates/universe TranslationIndex
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/main Translation-en
Hit http://eu-west-1.ec2.archive.ubuntu.com precise/universe Translation-en
Hit http://eu-west-1.ec2.archive.ubuntu.com precise-updates/main Translation-en
Hit http://eu-west-1.ec2.archive.ubuntu.com precise-updates/universe Translation-en
Get:18 http://security.ubuntu.com precise-security/main amd64 Packages [254 kB]
Get:19 http://security.ubuntu.com precise-security/universe amd64 Packages [72.0 kB]
Get:20 http://security.ubuntu.com precise-security/main i386 Packages [267 kB]
Get:21 http://security.ubuntu.com precise-security/universe i386 Packages [74.2 kB]
Hit http://security.ubuntu.com precise-security/main TranslationIndex
Hit http://security.ubuntu.com precise-security/universe TranslationIndex
Hit http://security.ubuntu.com precise-security/main Translation-en
Hit http://security.ubuntu.com precise-security/universe Translation-en
Fetched 2,980 kB in 2s (1,228 kB/s)
Reading package lists… Done
root@ip-10-48-234-13:~#

3. Install java7 JDK and JRE by apt-get

root@ip-10-48-234-13:~# sudo apt-get install oracle-java7-installer
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 x11-common xfonts-encodings xfonts-utils
Suggested packages:
default-jre equivs 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 firefox firefox-2
iceweasel mozilla-firefox iceape-browser mozilla-browser epiphany-gecko epiphany-webkit epiphany-browser galeon midbrowser moblin-web-browser xulrunner xulrunner-1.9 konqueror chromium-browser
midori google-chrome
The following NEW packages will be installed:
gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 oracle-java7-installer x11-common xfonts-encodings xfonts-utils
0 upgraded, 9 newly installed, 0 to remove and 72 not upgraded.
Need to get 4,342 kB of archives.
After this operation, 7,593 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/ precise/main oracle-java7-installer all 7u21-0~webupd8~0 [17.6 kB]
Get:2 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise/main java-common all 0.43ubuntu2 [61.7 kB]
Get:3 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise/main gsfonts all 1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1 [3,374 kB]
Get:4 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise/main libfontenc1 amd64 1:1.1.0-1 [15.4 kB]
Get:5 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise/main libxfont1 amd64 1:1.4.4-1 [133 kB]
Get:6 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates/main x11-common all 1:7.6+12ubuntu2 [52.0 kB]
Get:7 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise/main xfonts-encodings all 1:1.0.4-1ubuntu1 [583 kB]
Get:8 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise/main xfonts-utils amd64 1:7.6+1 [96.4 kB]
Get:9 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise/main gsfonts-x11 all 0.22 [9,108 B]
Fetched 4,342 kB in 1s (4,229 kB/s)
Preconfiguring packages …
Selecting previously unselected package java-common.
(Reading database … 49831 files and directories currently installed.)
Unpacking java-common (from …/java-common_0.43ubuntu2_all.deb) …
Selecting previously unselected package oracle-java7-installer.
Unpacking oracle-java7-installer (from …/oracle-java7-installer_7u21-0~webupd8~0_all.deb) …
Selecting previously unselected package gsfonts.
Unpacking gsfonts (from …/gsfonts_1%3a8.11+urwcyr1.0.7~pre44-4.2ubuntu1_all.deb) …
Selecting previously unselected package libfontenc1.
Unpacking libfontenc1 (from …/libfontenc1_1%3a1.1.0-1_amd64.deb) …
Selecting previously unselected package libxfont1.
Unpacking libxfont1 (from …/libxfont1_1%3a1.4.4-1_amd64.deb) …
Selecting previously unselected package x11-common.
Unpacking x11-common (from …/x11-common_1%3a7.6+12ubuntu2_all.deb) …
Selecting previously unselected package xfonts-encodings.
Unpacking xfonts-encodings (from …/xfonts-encodings_1%3a1.0.4-1ubuntu1_all.deb) …
Selecting previously unselected package xfonts-utils.
Unpacking xfonts-utils (from …/xfonts-utils_1%3a7.6+1_amd64.deb) …
Selecting previously unselected package gsfonts-x11.
Unpacking gsfonts-x11 (from …/gsfonts-x11_0.22_all.deb) …
Processing triggers for man-db …
Processing triggers for ureadahead …
Setting up java-common (0.43ubuntu2) …
Setting up oracle-java7-installer (7u21-0~webupd8~0) …
Downloading Oracle Java 7…
–2013-05-10 18:42:06– http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)… 23.62.99.27, 23.62.99.40
Connecting to download.oracle.com (download.oracle.com)|23.62.99.27|:80… connected.
HTTP request sent, awaiting response… 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz [following]
–2013-05-10 18:42:06– https://edelivery.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)… 23.51.102.140
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.51.102.140|:443… connected.
HTTP request sent, awaiting response… 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz?AuthParam=1368211560_1461eccbec5bc9125e1af1a6d8c56c2e [following]
–2013-05-10 18:42:06– http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz?AuthParam=1368211560_1461eccbec5bc9125e1af1a6d8c56c2e
Connecting to download.oracle.com (download.oracle.com)|23.62.99.27|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 96272413 (92M) [application/x-gzip]
Saving to: `jdk-7u21-linux-x64.tar.gz’0K …….. …….. …….. …….. …….. …….. 3% 10.7M 8s
3072K …….. …….. …….. …….. …….. …….. 6% 15.4M 7s
6144K …….. …….. …….. …….. …….. …….. 9% 8.08M 8s
9216K …….. …….. …….. …….. …….. …….. 13% 5.21M 9s
12288K …….. …….. …….. …….. …….. …….. 16% 5.78M 10s
15360K …….. …….. …….. …….. …….. …….. 19% 5.95M 10s
18432K …….. …….. …….. …….. …….. …….. 22% 5.85M 10s
21504K …….. …….. …….. …….. …….. …….. 26% 6.84M 10s
24576K …….. …….. …….. …….. …….. …….. 29% 7.35M 9s
27648K …….. …….. …….. …….. …….. …….. 32% 7.42M 9s
30720K …….. …….. …….. …….. …….. …….. 35% 6.36M 8s
33792K …….. …….. …….. …….. …….. …….. 39% 4.59M 8s
36864K …….. …….. …….. …….. …….. …….. 42% 5.34M 8s
39936K …….. …….. …….. …….. …….. …….. 45% 5.84M 8s
43008K …….. …….. …….. …….. …….. …….. 49% 6.27M 7s
46080K …….. …….. …….. …….. …….. …….. 52% 6.65M 7s
49152K …….. …….. …….. …….. …….. …….. 55% 7.33M 6s
52224K …….. …….. …….. …….. …….. …….. 58% 7.58M 6s
55296K …….. …….. …….. …….. …….. …….. 62% 7.84M 5s
58368K …….. …….. …….. …….. …….. …….. 65% 8.18M 5s
61440K …….. …….. …….. …….. …….. …….. 68% 6.77M 4s
64512K …….. …….. …….. …….. …….. …….. 71% 4.61M 4s
67584K …….. …….. …….. …….. …….. …….. 75% 5.54M 3s
70656K …….. …….. …….. …….. …….. …….. 78% 5.90M 3s
73728K …….. …….. …….. …….. …….. …….. 81% 6.27M 3s
76800K …….. …….. …….. …….. …….. …….. 84% 6.71M 2s
79872K …….. …….. …….. …….. …….. …….. 88% 7.57M 2s
82944K …….. …….. …….. …….. …….. …….. 91% 7.43M 1s
86016K …….. …….. …….. …….. …….. …….. 94% 3.16M 1s
89088K …….. …….. …….. …….. …….. …….. 98% 4.63M 0s
92160K …….. …….. …….. ….. 100% 5.33M=15s2013-05-10 18:42:21 (6.25 MB/s) – `jdk-7u21-linux-x64.tar.gz’ saved [96272413/96272413]Download done.
Removing outdated cached downloads…
update-alternatives: error: no alternatives for java.
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/apt to provide /usr/bin/apt (apt) 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/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/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libnpjp2.so (libnpjp2.so) in auto mode.
Oracle JRE 7 browser plugin installed
Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1) …
Setting up libfontenc1 (1:1.1.0-1) …
Setting up libxfont1 (1:1.4.4-1) …
Setting up x11-common (1:7.6+12ubuntu2) …
Setting up xfonts-encodings (1:1.0.4-1ubuntu1) …
Setting up xfonts-utils (1:7.6+1) …
Setting up gsfonts-x11 (0.22) …
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
root@ip-10-48-234-13:~#

4. Check java version

root@ip-10-48-234-13:~# java -version
java version “1.7.0_21”
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
root@ip-10-48-234-13:~#

That’s all. Thanks for using IThelpblog.com.

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>