Howto install Oracle's Java on LMDE/Debian

Write tutorials and howtos in here
More tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please, Before you post please read this

Howto install Oracle's Java on LMDE/Debian

Postby craigevil on Mon Apr 02, 2012 1:29 pm

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 craigevil on Fri May 11, 2012 6:39 am, edited 6 times in total.
Debian Sid KDE4.8.4 Kernel 3.4 Thinkpad R40 CPU Pentium M 1.3MHz RAM 2GB ATI 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
Level 5
Level 5
 
Posts: 559
Joined: Wed Sep 15, 2010 6:10 am
Location: down the rabbit hole

Linux Mint is funded by ads and donations.
 

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

Postby craigevil on Tue Apr 03, 2012 1:49 pm

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
Debian Sid KDE4.8.4 Kernel 3.4 Thinkpad R40 CPU Pentium M 1.3MHz RAM 2GB ATI 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
Level 5
Level 5
 
Posts: 559
Joined: Wed Sep 15, 2010 6:10 am
Location: down the rabbit hole

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

Postby zerozero on Tue Apr 03, 2012 2:47 pm

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:
Attachments
DeepinScrot-3352.png
DeepinScrot-3352.png (17.45 KiB) Viewed 29803 times
zerozero
Level 16
Level 16
 
Posts: 6467
Joined: Tue Jul 07, 2009 2:29 pm

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

Postby marsal71 on Mon Apr 09, 2012 9:04 am

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

It's easy (sun-java 6.31).
marsal71
Level 1
Level 1
 
Posts: 2
Joined: Mon Apr 09, 2012 8:52 am

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

Postby craigevil on Mon Apr 09, 2012 9:22 am

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)
Debian Sid KDE4.8.4 Kernel 3.4 Thinkpad R40 CPU Pentium M 1.3MHz RAM 2GB ATI 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
Level 5
Level 5
 
Posts: 559
Joined: Wed Sep 15, 2010 6:10 am
Location: down the rabbit hole

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

Postby GeneC on Wed Apr 11, 2012 3:03 pm

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

AMD Phenom2x4 3.2 ghz, 12GB DDR3, Nvidia GTX 460

Qiana (Cinnamon/XFCE)
Sparky XFCE (Debian Testing)
LMDE Cin 2.2 (SID)
User avatar
GeneC
Level 7
Level 7
 
Posts: 1538
Joined: Fri Sep 03, 2010 1:59 pm
Location: Maine, USA

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

Postby GeneC on Wed Apr 11, 2012 3:22 pm

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

AMD Phenom2x4 3.2 ghz, 12GB DDR3, Nvidia GTX 460

Qiana (Cinnamon/XFCE)
Sparky XFCE (Debian Testing)
LMDE Cin 2.2 (SID)
User avatar
GeneC
Level 7
Level 7
 
Posts: 1538
Joined: Fri Sep 03, 2010 1:59 pm
Location: Maine, USA

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

Postby GeneC on Wed Apr 11, 2012 4:16 pm

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

AMD Phenom2x4 3.2 ghz, 12GB DDR3, Nvidia GTX 460

Qiana (Cinnamon/XFCE)
Sparky XFCE (Debian Testing)
LMDE Cin 2.2 (SID)
User avatar
GeneC
Level 7
Level 7
 
Posts: 1538
Joined: Fri Sep 03, 2010 1:59 pm
Location: Maine, USA

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

Postby GeneC on Wed Apr 11, 2012 4:31 pm

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

AMD Phenom2x4 3.2 ghz, 12GB DDR3, Nvidia GTX 460

Qiana (Cinnamon/XFCE)
Sparky XFCE (Debian Testing)
LMDE Cin 2.2 (SID)
User avatar
GeneC
Level 7
Level 7
 
Posts: 1538
Joined: Fri Sep 03, 2010 1:59 pm
Location: Maine, USA

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

Postby ChiVampir on Sat Apr 14, 2012 5:24 pm

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.
User avatar
ChiVampir
Level 1
Level 1
 
Posts: 17
Joined: Tue May 03, 2011 4:29 pm
Location: Norway

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

Postby grizzler on Sun Apr 15, 2012 2:56 am

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.
grizzler
Level 4
Level 4
 
Posts: 422
Joined: Wed Jun 15, 2011 5:19 pm
Location: The Hague, NL

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

Postby ChiVampir on Sun Apr 15, 2012 5:36 am

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.
User avatar
ChiVampir
Level 1
Level 1
 
Posts: 17
Joined: Tue May 03, 2011 4:29 pm
Location: Norway

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

Postby äxl on Sun Apr 15, 2012 9:27 am

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
My Linux history: Ubuntu 10.04 - 10.10 - LMDE 201109 - UP4 My sources.list/preferences

Computers is not science. And it's not magic - it's something in between.
User avatar
äxl
Level 5
Level 5
 
Posts: 524
Joined: Fri Apr 06, 2012 6:14 am
Location: Germany

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

Postby zerozero on Sun Apr 15, 2012 9:34 am

ä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)
zerozero
Level 16
Level 16
 
Posts: 6467
Joined: Tue Jul 07, 2009 2:29 pm

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

Postby äxl on Sun Apr 15, 2012 11:25 am

I don't see a warning in about:plugins but I see it here: http://www.mozilla.org/en-US/plugincheck/
Thanks! :oops:
My Linux history: Ubuntu 10.04 - 10.10 - LMDE 201109 - UP4 My sources.list/preferences

Computers is not science. And it's not magic - it's something in between.
User avatar
äxl
Level 5
Level 5
 
Posts: 524
Joined: Fri Apr 06, 2012 6:14 am
Location: Germany

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

Postby craigevil on Sun Apr 15, 2012 2:19 pm

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
Debian Sid KDE4.8.4 Kernel 3.4 Thinkpad R40 CPU Pentium M 1.3MHz RAM 2GB ATI 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
Level 5
Level 5
 
Posts: 559
Joined: Wed Sep 15, 2010 6:10 am
Location: down the rabbit hole

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

Postby äxl on Sun Apr 15, 2012 3:00 pm

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.
My Linux history: Ubuntu 10.04 - 10.10 - LMDE 201109 - UP4 My sources.list/preferences

Computers is not science. And it's not magic - it's something in between.
User avatar
äxl
Level 5
Level 5
 
Posts: 524
Joined: Fri Apr 06, 2012 6:14 am
Location: Germany

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

Postby craigevil on Sun Apr 15, 2012 3:46 pm

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
Debian Sid KDE4.8.4 Kernel 3.4 Thinkpad R40 CPU Pentium M 1.3MHz RAM 2GB ATI 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
Level 5
Level 5
 
Posts: 559
Joined: Wed Sep 15, 2010 6:10 am
Location: down the rabbit hole

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

Postby zerozero on Sun Apr 15, 2012 3:55 pm

äxl wrote:Also in Opera.

see if this helps (not that i use opera that much) http://www.opera.com/docs/linux/plugins/install/
zerozero
Level 16
Level 16
 
Posts: 6467
Joined: Tue Jul 07, 2009 2:29 pm

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

Postby mintyed on Sun Apr 15, 2012 11:41 pm

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.
Enjoy It
Linux is many things to many people.
If you use it and it fits your needs enjoy it.
User avatar
mintyed
Level 2
Level 2
 
Posts: 89
Joined: Mon Mar 16, 2009 1:58 am

Linux Mint is funded by ads and donations.
 
Next

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 3 guests