LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > craigevil's random words of wisdom
User Name
Password

Notices


Ramblings about Debian GNU/Linux
Rate this Entry

Howto install Oracle Java on Debian

Posted 03-10-2012 at 02:47 PM by craigevil
Updated 07-15-2021 at 06:44 PM by craigevil (added wiki page)

Please see The Debian wiki Java page: https://wiki.debian.org/Java
Basically ignore this entire article and see https://adoptopenjdk.net/releases.html
https://adoptopenjdk.net/installation.html#linux-pkg

This post is outdated, Do NOT use it
Steps for Oracle Java 6


Quote:
Version 1.6.x (a.k.a Java 6 Update x)
NOTE: Java 6 is scheduled to die (End of Life or EOL) in November 2012
As of April 27, 2012 the latest version of Java 6 is 1.6.0_32 (Version 6 Update 32).
According to Oracle, "This release includes bug fixes and performance improvements." No security patches.

First install java-package, and fakeroot.
Code:
apt-get install java-package fakeroot
Quote:
Description-en: Utility for creating Java Debian packages
This package provides the capability to build a Debian package from
a Java binary distribution by running make-jpkg <java binary archive file>.
(with archive files downloaded from providers listed below)
.
Supported java binary distributions currently include:
* Oracle (http://www.oracle.com/technetwork/java/javase/downloads) :
- The J2SE Development Kit (JDK), version 6 (update >= 10), 7
- The J2SE Runtime Environment (JRE), version 6 (update >= 10), 7
- The J2SE API Javadoc, version 6 (update >= 10), 7
(Choose tar.gz archives or self-extracting archives, do _not_ choose the RPM!)
.
Please note that Debian recommends the use of openjdk-6-jdk/openjdk-6-jre
or openjdk-7-jdk/openjdk-7-jre. java-package will install non-free packages.
Note the link in the package description is broken.

Next download the appropriate .bin
Quote:
Download

Go to http://java.com and click on the Download button
There are two types of installation packages.
Linux self extracting binary file
This file can be used to install Java in a location chosen by the user and can be installed by anyone (not only root users). As long as you are not root user, it cannot displace the system version of the Java platform suppled by Linux.
Linux RPM package
Linux RPM (Redhat Package Manager) uses RPM to install Java. In order to use this method, you need to have RPM available on your system. Otherwise use the other option.
We want the Linux (self-extracting file) , pick the one for your system there is a 32bit and 64bit.
I run 32bit so I downloaded jre-6u31-linux-i586.bin.

cd to the directory where you downloaded it to.
Code:
cd /home/craig/Downloads/java/
then run:
Code:
fakeroot make-jpkg <java-binary-package-name>.bin
once that finishes you use dpkg to install the newly created .deb
Code:
dpkg -i oracle-j2re1.6_1.6.0+update31_i386.deb
Now you need to make sure you are using the right Java. Run the following commands as root:
Code:
update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javaws
update-alternatives --config jexec
update-alternatives --config mozilla-javaplugin.so
update-alternatives --config iceweasel-javaplugin.so
Last but not least, symlink Java
Code:
cd /usr/lib/mozilla/plugins/
Followed by :
Code:
ln -s /usr/lib/jvm/j2re1.6-oracle/lib/i386/libnpjp2.so
Now we can go check Iceweasel/Firefox/Chrome etc, aboutlugins
it should show something like:
Quote:
Java(TM) Plug-in 1.6.0_31

File: /usr/lib/jvm/j2re1.6-oracle/lib/i386/libnpjp2.so
You can also check in a terminal to make sure the correct Java is being used:
Code:
$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)
See what Java versions are installed:
Code:
# update-java-alternatives --list
j2re1.6-oracle 314 /usr/lib/jvm/j2re1.6-oracle
java-1.6.0-openjdk-i386 1061 /usr/lib/jvm/java-1.6.0-openjdk-i386

Basically 6 steps
1) Install java-package and fakeroot
2) download from Oracle
3) run make-jpkg
4) Install with dpkg
5) Update java-alternatives
6) symlink browser plugin

For more info see:
How to Install Sun Java on Debian
Java - Debian Wiki
Java/Sun - Debian Wiki
JavaPackage - Debian Wiki
How do I download and install Java for my Linux computer? -Oracle guide

If you run Ubuntu, Mint or other Ubuntu derivatives see:
Oracle (Sun) Java JRE for Ubuntu, Linux Mint and Debian
How To Install Oracle Java 7 In Debian Via Repository ~ Web Upd8: Ubuntu / Linux blog - http://www.webupd8.org/2012/06/how-t...in-debian.html
Java - Community Ubuntu Documentation
Java - Community Ubuntu Documentation - https://help.ubuntu.com/community/Java#Oracle_Java_7

Oracle Java7 , same steps as java 6 above

Download either the 32bit or 64bit tar.gz from:
http://www.oracle.com/technetwork/ja...d-1591157.html

Code:
fakeroot make-jpkg /home/craig/Downloads/java/jre-7u4-linux-i586.tar.gz
Code:
dpkg -i oracle-j2re1.7_1.7.0+update4_i386.deb
Now you need to make sure you are using the right Java. Run the following commands as root:
Code:
update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javaws
update-alternatives --config jexec
update-alternatives --config mozilla-javaplugin.so
update-alternatives --config iceweasel-javaplugin.so
I used kalternatives in Systensettings.

symlink the plugin : as root
Code:
cd /usr/lib/mozilla/plugins/
Followed by :
Code:
ln -s /usr/lib/jvm/j2re1.7-oracle/lib/i386/libnpjp2.so
Code:
$ java -version
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) Client VM (build 23.0-b21, mixed mode)
Quote:
Version 1.7 (a.k.a Java 7)

As of April 27, 2012 the latest version of Java 7 is Update 4.
According to Oracle: "This release includes bug fixes and performance improvements, including a new JVM, Mac OS X support ... and more!" No security patches.
Posted in Uncategorized
Views 64395 Comments 8
« Prev     Main     Next »
Total Comments 8

Comments

  1. Old Comment
    The only drawback to install Java this way is you need to check for updates manually.

    Oracle released updates for Java6 and java7 today.
    Java SE Downloads - http://www.oracle.com/technetwork/ja...sp-138363.html

    Already updated Java on my system:
    Java(TM) Plug-in 1.6.0_32

    File: /usr/lib/jvm/j2re1.6-oracle/lib/i386/libnpjp2.so

    $ apt-cache policy oracle-j2re1.6
    oracle-j2re1.6:
    Installed: 1.6.0+update32
    Candidate: 1.6.0+update32
    Posted 04-26-2012 at 04:30 PM by craigevil craigevil is offline
  2. Old Comment
    Script (JRE only)

    Only supports Oracle (Sun) Java 7 JRE (which covers the needs of 99 % of all computer users). It pulls the packages from Oracle's website and installs them, comparable to the way Adobe Flash Player is being installed. Plus it adds a dedicated repository, from which you'll receive updates automatically.

    http://www.duinsoft.nl/packages.php?t=en
    Posted 06-04-2012 at 10:27 AM by craigevil craigevil is offline
  3. Old Comment

    Oracle to patch 14 critical Java SE holes on Tuesday

    Oracle to patch 14 critical Java SE holes on Tuesday - http://www.h-online.com/open/news/it...y-1614778.html
    Quote:
    Oracle to patch 14 critical Java SE holes on Tuesday

    Oracle says it will be patching fourteen vulnerabilities in Java SE (Standard Edition) this coming Tuesday, 12 June. All versions of Java, including the JDK and JRE version 7 update 4 and earlier, version 6 update 32 and earlier, version 5 update 35 and earlier, 1.4_2_37 and earlier, and JavaFX 2.1 and earlier are affected.
    The company says that it will be strongly recommending that all users apply the patch update "due to the threat posed by a successful attack". Oracle says the highest CVSS base score of the vulnerabilities is 10.0. Twelve of the vulnerabilities may be exploited remotely without any authentication. The problems all reside in the Java Runtime Environment (JRE).
    Posted 06-10-2012 at 12:51 AM by craigevil craigevil is offline
  4. Old Comment
    Don't forget to download and install updated versions of Java.


    $ java -version
    java version "1.7.0_05"
    Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
    Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode)

    Took 5 minutes to download and a minute to build and install:
    The Debian package has been created in the current directory. You can
    install the package as root (e.g. dpkg -i oracle-j2re1.7_1.7.0+update5_i386.deb).
    Posted 06-12-2012 at 01:58 PM by craigevil craigevil is offline
  5. Old Comment
    How To Install Oracle Java 7 In Debian Via Repository ~ http://www.webupd8.org/2012/06/how-t...in-debian.html

    Code:
    su -
    echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" > /etc/apt/sources.list.d/webupd8team-java.list
    echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list.d/webupd8team-java.list
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
    apt-get update
    apt-get install oracle-java7-installer
    exit
    Posted 06-19-2012 at 11:46 PM by craigevil craigevil is offline
  6. Old Comment
    I'm not sure whether the process I followed is correct or not, but I installed oracle java through a simpler mechanism on my squeeze. I just downloaded the latest Netbeans+JDK-7u5 package for Linux from http://www.oracle.com/technetwork/ja...ads/index.html.

    Then I simply ran the shell in a terminal to invoke the JDK installer:

    sh ./jdk-7u5-nb-7_1_2-linux-ml.sh

    The graphical installer then did the rest of the things including installing JDK and netbeans on the chosen path.
    Posted 07-17-2012 at 04:11 PM by prahladyeri prahladyeri is offline
  7. Old Comment
    A few other ways:

    Installing Java 7 on Debian - http://alexander.holbreich.org/2011/...a-7-on-debian/

    How to install Oracle Java on Debian / Ubuntu | a Linux sysadmin blog - http://www.frederikkonietzny.de/2012...debian-ubuntu/

    How to Install Oracle Java on Ubuntu Linux: 18 steps - wikiHow - http://www.wikihow.com/Install-Oracl...n-Ubuntu-Linux

    Loving the Penguin: Installing Oracle Java in Wheezy - http://lovingthepenguin.blogspot.com...in-wheezy.html

    Install Oracle Java 8 In Ubuntu VIa PPA [JDK8] ~ Web Upd8: Ubuntu / Linux blog - http://www.webupd8.org/2012/09/insta...u-via-ppa.html
    Posted 09-15-2012 at 11:55 AM by craigevil craigevil is offline
  8. Old Comment
    New update that fixes several security issues:

    Java(TM) Runtime Environment (JRE)
    Standard Edition, Version 1.7.0+update9
    Oracle Microsystems(TM), Inc.

    Install using the tar.gz file

    fakeroot make-jpkg /home/craig/Downloads/jre-7u9-linux-i586.tar.gz

    then use dpkg to install the newly created deb package.
    dpkg -i oracle-j2re1.7_1.7.0+update9_i386.deb

    $ java -version
    java version "1.7.0_09"
    Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
    Java HotSpot(TM) Client VM (build 23.5-b02, mixed mode)
    Posted 10-19-2012 at 01:59 PM by craigevil craigevil is offline
    Updated 10-19-2012 at 02:02 PM by craigevil
 

  



All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration