Howto Install Oracle Java

Share your own howto's etc. Not for support questions!

Howto Install Oracle Java

Postby craigevil » 2012-03-14 00:16

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 - http://www.crazysquirrel.com/computing/debian/java.jspx
Java - Debian Wiki - http://wiki.debian.org/Java
Java/Sun - Debian Wiki - http://wiki.debian.org/Java/Sun
JavaPackage - Debian Wiki - http://wiki.debian.org/JavaPackage
Debian Sid KDE Kernel 3.17 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"
Debian upgrade script smxi | sysinfo script inxi
User avatar
craigevil
 
Posts: 5158
Joined: 2006-09-17 03:17
Location: Oz

Re: Howto Install Oracle Java

Postby sossego » 2012-03-14 02:01

A note to this tutorial:
I've recently been working with the ppc jre and sdk archive.bin and normal binaries for the POWER architecture.
This is what doesn't work; so, don't forget the errors here.
Code: Select all
chmod +x IBM_ppc java binary
su:
#./ppc-binary-java

http://www.ibm.com/developerworks/forum ... 5&tstart=0
Let my desire and hope surpass my expectations;
And give me the strength to persevere through doubt.
Grant me the wisdom to exceed my bounds.
Let my eyes always see through the dream fog of childhood,
so that every moment may be treasured.
User avatar
sossego
 
Posts: 1072
Joined: 2007-03-20 23:52

Re: Howto Install Oracle Java

Postby sej7278 » 2012-03-14 09:22

what's the point in packaging it?

just download the binary and fix the alternatives/symlinks.
sej7278
 
Posts: 220
Joined: 2011-06-11 17:03

Re: Howto Install Oracle Java

Postby milomak » 2012-04-18 19:05

ah this solved the issue i was having with my firefox java on sid
Laptop (64-bit) - Debian Sid and Win8
Desktop (64-bit) - Debian Sid, ArchLinux, Win8 and Fedora 19
MythTV BE/FE - Debian Stable
MythTV FE - Debian Sid
milomak
 
Posts: 1408
Joined: 2009-06-09 22:20

Re: Howto Install Oracle Java

Postby craigevil » 2012-04-18 19:43

sej7278 wrote:what's the point in packaging it?

just download the binary and fix the alternatives/symlinks.


By installing a .deb of Java packages that depend on java will see it, plus this way it is simple to remove.

Just downloading and installing the binary makes as much sense as randomly installing packages from the web. Which is to say absolutely none.
Debian Sid KDE Kernel 3.17 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"
Debian upgrade script smxi | sysinfo script inxi
User avatar
craigevil
 
Posts: 5158
Joined: 2006-09-17 03:17
Location: Oz

Re: Howto Install Oracle Java

Postby sej7278 » 2012-04-18 21:47

craigevil wrote:
sej7278 wrote:what's the point in packaging it?

just download the binary and fix the alternatives/symlinks.


By installing a .deb of Java packages that depend on java will see it, plus this way it is simple to remove.

Just downloading and installing the binary makes as much sense as randomly installing packages from the web. Which is to say absolutely none.


no, i don't agree, java as a package is not maintained so you'll have to go to the website for updates anyway.

its not difficult to remove as its one directory these days.

with the downloaded binary you can (if you want) have multiple versions installed, rather than a package that overwrites the previous version.

if deb packages that depend on java don't see it as they're only looking for other packages, then they're not packaged correctly; but i don't know of any package that depends on oracle java anyway.

i can only see the point in packaging it if you're doing a large-scale rollout on lots of servers, the average home user doesn't need the hassle.

plus javapackage is only available in wheezy/sid, not squeeze.
sej7278
 
Posts: 220
Joined: 2011-06-11 17:03

Re: Howto Install Oracle Java

Postby kce » 2012-08-22 02:12

Does Oracle still offer the self-extracting binary for download?

I can't seem to find it available for download (http://www.java.com/en/download/linux_m ... ?locale=en).
More paranoid than AMLJ!
User avatar
kce
 
Posts: 265
Joined: 2008-10-31 16:48

Re: Howto Install Oracle Java

Postby debil » 2012-08-22 10:14

kce wrote:Does Oracle still offer the self-extracting binary for download?

I can't seem to find it available for download (http://www.java.com/en/download/linux_m ... ?locale=en).

I didn't find any .bin files either so opted to grab the .tar.gz package instead. Extract it into /opt. Make a symbolic link jre that points to jre1.7.0_05 (current JRE), update-alternatives stuff (java and javaws) to /opt/jre/bin/java and /opt/jre/bin/javaws. And finally the browser plugin: cd /usr/lib/mozilla/plugins/, ln -s /opt/jre/lib/amd64/libnpjp2.so.
Q: Why is the Eunux kernel so bloated?
A: It was made in the image of its founder.
User avatar
debil
 
Posts: 1337
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: Howto Install Oracle Java

Postby craigevil » 2012-08-22 15:44

$ apt-cache policy oracle-j2re1.7
oracle-j2re1.7:
Installed: 1.7.0+update5
Candidate: 1.7.0+update5
Version table:
*** 1.7.0+update5 0
100 /var/lib/dpkg/status

java-package works with the tar package as well.


Java - Version: 1.7.0_05
Java plug-in for NPAPI-based browsers.
Name: Java(TM) Plug-in 1.7.0_05
Description: Java plug-in for NPAPI-based browsers.
Version: 1.7.0_05
Location: /usr/lib/jvm/j2re1.7-oracle/lib/i386/libnpjp2.so
Type: NPAPI
Debian Sid KDE Kernel 3.17 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"
Debian upgrade script smxi | sysinfo script inxi
User avatar
craigevil
 
Posts: 5158
Joined: 2006-09-17 03:17
Location: Oz

Re: Howto Install Oracle Java

Postby debil » 2012-08-22 16:28

craigevil wrote:java-package works with the tar package as well.

Well, d'oh... Thanks for clearing that out. Didn't even test it. Problem fixed.
Q: Why is the Eunux kernel so bloated?
A: It was made in the image of its founder.
User avatar
debil
 
Posts: 1337
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: Howto Install Oracle Java

Postby sej7278 » 2012-08-23 08:02

bin files are on main oracle site, i just installed JDK 6u34 yesterday using this method (had to set a lot of symlinks/alternatives up)

JDK: http://www.oracle.com/technetwork/java/ ... 37591.html

JRE: http://www.oracle.com/technetwork/java/ ... 37595.html
sej7278
 
Posts: 220
Joined: 2011-06-11 17:03

Re: Howto Install Oracle Java

Postby milomak » 2012-09-07 21:45

debil wrote:
craigevil wrote:java-package works with the tar package as well.

Well, d'oh... Thanks for clearing that out. Didn't even test it. Problem fixed.


how did you go about this?
Laptop (64-bit) - Debian Sid and Win8
Desktop (64-bit) - Debian Sid, ArchLinux, Win8 and Fedora 19
MythTV BE/FE - Debian Stable
MythTV FE - Debian Sid
milomak
 
Posts: 1408
Joined: 2009-06-09 22:20

Re: Howto Install Oracle Java

Postby debil » 2012-09-07 22:26

milomak wrote:
debil wrote:
craigevil wrote:java-package works with the tar package as well.

Well, d'oh... Thanks for clearing that out. Didn't even test it. Problem fixed.

how did you go about this?

Pretty much like in the OP but straight with the .tar.gz package. I.e. (64-bit version in this case):
Code: Select all
$ fakeroot make-jpkg jre*.tar.gz
# dpkg -i jre*.deb
# cd /usr/lib/mozilla/plugins
# ln -s /usr/lib/jvm/j2re1.7-oracle/lib/amd64/libnpjp2.so
# update-alternatives --config java
# update-alternatives --config javaws
Q: Why is the Eunux kernel so bloated?
A: It was made in the image of its founder.
User avatar
debil
 
Posts: 1337
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: Howto Install Oracle Java

Postby lbm » 2012-11-21 09:24

debil wrote:
kce wrote:Does Oracle still offer the self-extracting binary for download?

I can't seem to find it available for download (http://www.java.com/en/download/linux_m ... ?locale=en).

I didn't find any .bin files either so opted to grab the .tar.gz package instead. Extract it into /opt. Make a symbolic link jre that points to jre1.7.0_05 (current JRE), update-alternatives stuff (java and javaws) to /opt/jre/bin/java and /opt/jre/bin/javaws. And finally the browser plugin: cd /usr/lib/mozilla/plugins/, ln -s /opt/jre/lib/amd64/libnpjp2.so.


How have you configured the alternative directory ?
I have extracted it in /opt/, and created a symlink, so far so good. But now I am kinda stuck.

--edit--
Create the symlinks and it seems to be working now.
Code: Select all
cd /usr/lib/mozilla/plugins/
ln -s /opt/jre/lib/amd64/libnpjp2.so
User avatar
lbm
 
Posts: 461
Joined: 2009-05-16 09:24
Location: Denmark

Re: Howto Install Oracle Java

Postby golinux » 2013-01-11 22:36

debil wrote:
Code: Select all
$ fakeroot make-jpkg jre*.tar.gz
# dpkg -i jre*.deb
# cd /usr/lib/mozilla/plugins
# ln -s /usr/lib/jvm/j2re1.7-oracle/lib/amd64/libnpjp2.so
# update-alternatives --config java
# update-alternatives --config javaws

These instructions were helpful and got me started on the right track. However, with the latest java, the .deb wasn't being created.
Code: Select all
$ fakeroot make-jpkg jre-7u10-linux-i586.tar.gz
Creating temporary directory: /tmp/make-jpkg.6MO88KwrnR
Loading plugins: /usr/share/java-package/common.sh /usr/share/java-package/j2re.sh /usr/share/java-package/j2sdk-doc.sh /usr/share/java-package/j2sdk.sh /usr/share/java-package/j2se.sh /usr/share/java-package/oracle-j2re.sh /usr/share/java-package/oracle-j2sdk-doc.sh /usr/share/java-package/oracle-j2sdk.sh

Detected Debian build architecture: i386
Detected Debian GNU type: i486-linux-gnu

No matching plugin was found.
Removing temporary directory: done

I finally found the solution over on the Mint forums.

And since my system is 32-bit, I had to alter the sym link to this in the /usr/lib/mozilla/plugins folder:

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

It's working in chrome and chromium but not iceweasel on a certain site even though it is detected in iceweasel about:plugins etc and with the problem site's java tester. But after the animated java logo runs it says "no image available" instead of loading the document.

Then I was advised that libnpjp2.so was for 64-bit (even though it was in the 32-bit folder) and that I should link to /usr/lib/jvm/j2re1.7-oracle/lib/i386/libjavaplugin_oji.so for 32-bit. But iceweasel doesn't recognize that at all. Image loading permissions in about:config and preferences are OK. So just which file do I need to link to for the 32-bit java browser plugin? Can this be fixed?
Blessed are the 'troublemakers' who strive to right wrongs and shine light into dark places.
User avatar
golinux
 
Posts: 634
Joined: 2010-12-09 00:56
Location: not a 'buntard!

Next

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable