Howto Install Oracle Java

Share your wisdom. Not for support questions!

Moderator: How-to Curator

Howto Install Oracle Java

Postby craigevil » March 10th, 2012, 8:42 pm

DISCUSS this How-To Here

First install java-package, I know it is in sid, not sure if it is in Testing. Also need fakeroot.
Code: Select all
apt-get install java-package fakeroot


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
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: Select all
cd /home/craig/Downloads/java/

then run:
Code: Select all
fakeroot make-jpkg <java-binary-package-name>.bin

once that finishes you use dpkg to install the newly created .deb
Code: Select all
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: Select all
update-alternatives --config java
update-alternatives --config javac


Last but not least, symlink Java
Code: Select all
cd /usr/lib/mozilla/plugins/

Followed by :
Code: Select all
ln -s /usr/lib/jvm/j2re1.6-oracle/lib/i386/libnpjp2.so


Now we can go check Iceweasel/Firefox/Chrome etc, about:plugins
it should show something like:
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: Select all
$ 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: Select all
# 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
Debian Sid KDE 4 Kernel 3.7 Thinkpad R40 Intel M 1.3 CPU 2GB RAM Radeon Mobility 7500
Debian - "If you can't apt-get something, it isn't useful or doesn't exist"
Giant Debian sources.list | Debian upgrade script smxi | sysinfo script inxi
craigevil
 
Posts: 122
Joined: March 12th, 2011, 8:42 am
Location: down the rabbit hole

Return to HowTo

Who is online

Users browsing this forum: No registered users and 1 guest

x