Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Howto Install Oracle Java

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

Howto Install Oracle Java

#1 Post by craigevil »

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
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

User avatar
sossego
Posts: 1072
Joined: 2007-03-20 23:52

Re: Howto Install Oracle Java

#2 Post by sossego »

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.

sej7278
Posts: 225
Joined: 2011-06-11 17:03

Re: Howto Install Oracle Java

#3 Post by sej7278 »

what's the point in packaging it?

just download the binary and fix the alternatives/symlinks.

milomak
Posts: 2158
Joined: 2009-06-09 22:20
Been thanked: 1 time

Re: Howto Install Oracle Java

#4 Post by milomak »

ah this solved the issue i was having with my firefox java on sid
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

Re: Howto Install Oracle Java

#5 Post by craigevil »

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.
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

sej7278
Posts: 225
Joined: 2011-06-11 17:03

Re: Howto Install Oracle Java

#6 Post by sej7278 »

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.

User avatar
kce
Posts: 265
Joined: 2008-10-31 16:48

Re: Howto Install Oracle Java

#7 Post by kce »

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
debil
Posts: 1336
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: Howto Install Oracle Java

#8 Post by debil »

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
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

Re: Howto Install Oracle Java

#9 Post by craigevil »

$ 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
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

User avatar
debil
Posts: 1336
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: Howto Install Oracle Java

#10 Post by debil »

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.

sej7278
Posts: 225
Joined: 2011-06-11 17:03

Re: Howto Install Oracle Java

#11 Post by sej7278 »

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

milomak
Posts: 2158
Joined: 2009-06-09 22:20
Been thanked: 1 time

Re: Howto Install Oracle Java

#12 Post by milomak »

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?
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

User avatar
debil
Posts: 1336
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: Howto Install Oracle Java

#13 Post by debil »

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
lbm
Posts: 494
Joined: 2009-05-16 09:24
Location: Denmark

Re: Howto Install Oracle Java

#14 Post by lbm »

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
golinux
Posts: 1579
Joined: 2010-12-09 00:56
Location: not a 'buntard!
Been thanked: 1 time

Re: Howto Install Oracle Java

#15 Post by golinux »

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?
May the FORK be with you!

kmathern
Posts: 603
Joined: 2011-02-05 19:20

Re: Howto Install Oracle Java

#16 Post by kmathern »

golinux wrote:
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?
The libnpjp2.so plugin is what you should be using on both 32bit & 64bit if you're using firefox (or iceweasel) versions 3.6 and higher. The libjavaplugin_oji.so plugin was for 3.5 and earlier versions of firefox (or iceweasel) http://forums.mozillazine.org/viewtopic ... #p10153703

There's currently a security vulnerability with java plugin 7 update 10 and lower (https://addons.mozilla.org/en-US/firefox/blocked/p184). Firefox 19 which I'm using is blocking java and making me "click-to-play" on some java related stuff that I've tried (for instance http://www.time.gov/timezone.cgi?Eastern/d/-5/java). Iceweasel might be doing the same java blocking and that might be the reason that certain site you mention doesn't work.

User avatar
golinux
Posts: 1579
Joined: 2010-12-09 00:56
Location: not a 'buntard!
Been thanked: 1 time

Re: Howto Install Oracle Java

#17 Post by golinux »

kmathern wrote:The libnpjp2.so plugin is what you should be using on both 32bit & 64bit if you're using firefox (or iceweasel) versions 3.6 and higher. The libjavaplugin_oji.so plugin was for 3.5 and earlier versions of firefox (or iceweasel) http://forums.mozillazine.org/viewtopic ... #p10153703
Thank you for answering that question.
kmathern wrote:There's currently a security vulnerability with java plugin 7 update 10 and lower (https://addons.mozilla.org/en-US/firefox/blocked/p184). Firefox 19 which I'm using is blocking java and making me "click-to-play" on some java related stuff that I've tried (for instance http://www.time.gov/timezone.cgi?Eastern/d/-5/java). Iceweasel might be doing the same java blocking and that might be the reason that certain site you mention doesn't work.
Since I am still using iceweasel 10.0.11, I don't think that's a problem for me. And I am not getting any "click-to-play" nags on the timezone site or elsewhere. This from the link you provided:
Who is affected?
All users who have these versions of the plugin installed in Firefox 17 and above.
*edit* I also installed midori and java works perfectly on the problem site so it seems to be a mozilla specific bug.
May the FORK be with you!

gmorehouse
Posts: 6
Joined: 2013-08-05 15:54

Re: Howto Install Oracle Java

#18 Post by gmorehouse »

For anybody having problems, I've found that Oracle is serving misnamed and badly-tarred files (today, at least, who knows what tomorrow will be).

Essentially, if you get a '.gz' file, it's probably a tar file, but you need to untar it and then re-tarball it or 'make-jpkg' won't work. :roll:

http://gmorehou.wordpress.com/2013/08/0 ... -aug-2013/

Post Reply