Howto install Oracle's Java on LMDE/Debian

Archived topics about LMDE 1 and LMDE 2
craigevil

Howto install Oracle's Java on LMDE/Debian

Post by craigevil »

Steps for Oracle Java 6

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: 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
update-alternatives --config javaws
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

If you run Ubuntu, Mint or other Ubuntu derivatives see:
Oracle (Sun) Java JRE for Ubuntu, Linux Mint and Debian
Java - Community Ubuntu Documentation

Oracle Java7 , same steps as java 6 above

Download either the 32bit or 64bit tar.gz from:
http://www.oracle.com/technetwork/java/ ... 91157.html

Code: Select all

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

Code: Select all

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: Select all

update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javaws
I used kalternatives in Systensettings.

symlink the plugin : as root

Code: Select all

cd /usr/lib/mozilla/plugins/
Followed by :

Code: Select all

ln -s /usr/lib/jvm/j2re1.7-oracle/lib/i386/libnpjp2.so

Code: Select all

$ 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)
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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 7 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
craigevil

Re: Howto install Oracle's Java on LMDE/Debian

Post by craigevil »

Due to security issues with older versions of Java they are now blocked in Firefox. Please update your Java.

Older versions have been added to Firefox's blocklist

As per Blocking Java
zerozero

Re: Howto install Oracle's Java on LMDE/Debian

Post by zerozero »

worked flawlessly (and yes i saw some java blocking already)

Code: Select all

amadeu@amadeu:~$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
the only change is, that for 64bit i went with this:
marsal71

Re: Howto install Oracle's Java on LMDE/Debian

Post by marsal71 »

You must try steps in http://www.duinsoft.nl/packages.php?t=en

It's easy (sun-java 6.31).
craigevil

Re: Howto install Oracle's Java on LMDE/Debian

Post by craigevil »

marsal71 wrote:You must try steps in http://www.duinsoft.nl/packages.php?t=en

It's easy (sun-java 6.31).
You really need to change the wording on your webpage so it says Oracle and not Sun. I would change the page title as well. Fix the page up and post the script in the forums for others to checkout, if everything is kosher I will add your repo to my Giant sources.list and add a link to my howto.

Adding a repo in order to download a script really makes no sense. A link to download the script which you should be able to run without installing anything is really all that is needed.. You should also have someone that speaks/reads English well proofread the page. Switching to Openjdk was the recommended way of dealing with Java, and it gets updated regularly.

The method in my post, creates a proper .deb package so it can be easily removed when it is time to upgrade. It also puts it in the correct directory. And takes less than 5 minutes to have a working Oracle Java install. All without downloading some random script off the internet from some random person that does God only knows what. 8)
GeneC

Re: Howto install Oracle's Java on LMDE/Debian

Post by GeneC »

I followed instructions and installation went fine.

Code: Select all

gene@zordon:~$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

Code: Select all

gene@zordon:~$ sudo update-java-alternatives --list
[sudo] password for gene: 
j2re1.6-oracle 314 /usr/lib/jvm/j2re1.6-oracle
java-6-sun 63 /usr/lib/jvm/java-6-sun
BUT, I get an error message

If I disable Shockwave Flash
The error goes away and loads fine.
Last edited by GeneC on Thu Apr 12, 2012 4:11 pm, edited 2 times in total.
GeneC

Re: Howto install Oracle's Java on LMDE/Debian

Post by GeneC »

Well I see that I can runs some things without Shockwave Flash but not You tube vids in Chrome. WTH! :shock:
With it still can't run You tube (undefined message)

Firefox works fine.
I prefer Chrome.
What's the fix?
Image
GeneC

Re: Howto install Oracle's Java on LMDE/Debian

Post by GeneC »

I got it (almost) :lol:

Un-installled

Code: Select all

mint-flashplugin-11
Installed

Code: Select all

flashplugin-nonfree
Now have

Code: Select all

Flash - Version: 11.2 r202
Shockwave Flash 11.2 r202
Everything works, But the (almost) is I have blue people

Image

I know I saw couple thread on this.
Time for more research
Some days LMDE is a real =
Image :lol: :lol:
GeneC

Re: Howto install Oracle's Java on LMDE/Debian

Post by GeneC »

Right click on video
Go to settings
Un-tick " enable hardware acceleration".
No more blue people, but no hardware acceleration either. :cry:
ChiVampir

Re: Howto install Oracle's Java on LMDE/Debian

Post by ChiVampir »

It's also possible to install sun-java by adding debian's non-free repositories (these are the ones for stable using a Norwegian mirror):

Code: Select all

deb http://ftp.no.debian.org/debian/ squeeze non-free 
deb-src http://ftp.no.debian.org/debian/ squeeze non-free
Edit: It seems like the java version in the debian repository is outdated and full of security holes, so this version is not recommended. Sorry..
Last edited by ChiVampir on Sun Apr 15, 2012 6:11 am, edited 2 times in total.
grizzler

Re: Howto install Oracle's Java on LMDE/Debian

Post by grizzler »

The most recent version of the sun-java6 packages in the non-free repos is 6-26. That one is ancient and full of security holes. Using it is not a good idea.
ChiVampir

Re: Howto install Oracle's Java on LMDE/Debian

Post by ChiVampir »

grizzler wrote:The most recent version of the sun-java6 packages in the non-free repos is 6-26. That one is ancient and full of security holes. Using it is not a good idea.
Ok, thanks :)
I also forgot to mention that the non-free repository of debian conflicts with the linux mint repositories so it has to be quoted out after installation.
äxl

Re: Howto install Oracle's Java on LMDE/Debian

Post by äxl »

grizzler wrote:The most recent version of the sun-java6 packages in the non-free repos is 6-26. That one is ancient and full of security holes. Using it is not a good idea.
Why shouldn't it? Thousands of Debian users do it. http://packages.debian.org/sun-java6-jre
zerozero

Re: Howto install Oracle's Java on LMDE/Debian

Post by zerozero »

äxl, read the second post in this topic by craigevil, the java v. available in the debian repos is outdated and with security issues (you see that warning in FF if you go to about:plugins)
äxl

Re: Howto install Oracle's Java on LMDE/Debian

Post by äxl »

I don't see a warning in about:plugins but I see it here: http://www.mozilla.org/en-US/plugincheck/
Thanks! :oops:
craigevil

Re: Howto install Oracle's Java on LMDE/Debian

Post by craigevil »

The version of sun-java in the Debian repo should not be used.

The general advice is to use Openjdk instead. However it does not work 100% , which is why I installed Oracle's Java.

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)
I also have Openjdk6 installed, I have it disabled in Chrome and Firefox. In Chrome I also have flashplayer-mozilla disabled since Chrome has Flash built it.

Code: Select all

Java - Version: 1.6.0_31
The next generation Java plug-in for Mozilla browsers.
Name:	Java(TM) Plug-in 1.6.0_31
Description:	The next generation Java plug-in for Mozilla browsers.
Version:	1.6.0_31
Location:	/usr/lib/jvm/j2re1.6-oracle/lib/i386/libnpjp2.so
Type:	NPAPI

Code: Select all

Flash (2 files) - Version: 11.2 r202
Shockwave Flash 11.2 r202
Name:	Shockwave Flash
Version:	11.2 r202
Location:	/opt/google/chrome/libgcflashplayer.so
Type:	NPAPI
 	 Disable
MIME types:	
MIME type	Description	File extensions
application/x-shockwave-flash	Shockwave Flash	
.swf
application/futuresplash	FutureSplash Player	
.spl
Name:	Shockwave Flash
Version:	11.2 r202
Location:	/usr/lib/flashplayer-mozilla/libflashplayer.so
Type:	NPAPI
 	 Enable
MIME types:	
MIME type	Description	File extensions
application/x-shockwave-flash	Shockwave Flash	
.swf
application/futuresplash	FutureSplash Player	
.spl
äxl

Re: Howto install Oracle's Java on LMDE/Debian

Post by äxl »

craigevil wrote:The general advice is to use Openjdk instead.
Alright I'll try that first. But thanks for this tutorial in advance! ;)
I also have Openjdk6 installed, I have it disabled in Chrome and Firefox. In Chrome I also have flashplayer-mozilla disabled since Chrome has Flash built it.
How to disable them? Also in Opera.
craigevil

Re: Howto install Oracle's Java on LMDE/Debian

Post by craigevil »

on Chrome open about:plugins find the plugin you want to disable click disable. On Firefox open addons>plugins click disable.no clue about Opera haven't used out in ages.

Sent from my MOTWX435KT using Tapatalk 2
zerozero

Re: Howto install Oracle's Java on LMDE/Debian

Post by zerozero »

äxl wrote:Also in Opera.
see if this helps (not that i use opera that much) http://www.opera.com/docs/linux/plugins/install/
mintyed

Re: Howto install Oracle's Java on LMDE/Debian

Post by mintyed »

when running this it broke my os
  1. Code: Select all

    apt-get install java-package fakeroot
  2. it went to this window http://imagebin.org/208326.
  3. I could not press OK so i continued the rest of the steps and built the package for java.
  4. when it came to install the new java file. it gave message "cannot run more than one package manager at a time".
  5. i closed the above window and tried again. it did not work same error.
  6. i went into synaptic and it gave me to run this command to fix

    Code: Select all

    sudo dpkg --configure -a
    what that did is run the. above window again
also how to revert back to what was working before
it seems something is accessing apt even after a reboot so i cant run

Code: Select all

sudo apt-get update --fix-missing
or

Code: Select all

sudo apt-get upgrade --fix-missing
I am lost and cant install anything now can you please help asap.

Edit: A kind person in our irc channel #linuxmint-debian pointed out all i needed to do was press tab first. This selected the OK button and pressing return then worked. Problem Solved.
Last edited by mintyed on Mon Apr 16, 2012 6:15 pm, edited 2 times in total.
Locked

Return to “LMDE Archive”