HOWTO: Install Oracle Java automatically and easily

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
doktornotor
Level 4
Level 4
Posts: 212
Joined: Mon Jan 23, 2012 6:28 pm

HOWTO: Install Oracle Java automatically and easily

Postby doktornotor » Sun Jan 29, 2012 6:54 am

1/ Install Oracle Java

Code: Select all

 echo "deb http://www.duinsoft.nl/pkg debs all" | sudo tee /etc/apt/sources.list.d/oracle-java.list
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26
sudo apt-get update
sudo apt-get install update-sun-jre


The above will automatically download, install and setup Oracle Java from the Oracle site. It also installs a script to /usr/sbin/update-sun-jre which you can use to update the Java when a new version comes out.

Code: Select all

$ sudo update-sun-jre -v -i install


There are some other options provided by the script (such as forcing 32bit Java) which might be useful, see below.

Code: Select all

Usage: update-sun-jre [OPTION]... COMMAND

Install, upgrade or remove the Oracle (Sun) Java 6 Runtime Environment from
www.java.com.

Options:
  -a          force installation of a 32 bit runtime on a 64 bit system (will
              also work the other way around but for downloading only!)
  -c          clean up other installations (in /opt/java) during installation
  -f          shorten timeouts on wget actions
  -h, --help  display this text and exit
  -i          force installation of the runtime even if not strictly necessary
  -r          reload the info page whether it has been cached or not
  -v          be verbose

The unpack messages of the binary package will never be echoed on screen.

Commands:
  install     download the binary package from www.java.com and install it
  remove      remove the package (only after manual installation)


2/ Manage multiple Java implementations

The below is only tested on LMDE, not sure how/whether it works on Ubuntu Mint editions.

Code: Select all

sudo update-alternatives --config [jar|java|java_vm|javaws|jcontrol|jexec]


Usage example:

Code: Select all

$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /opt/java/64/jre1.6.0_30/bin/java                2000      auto mode
  1            /opt/java/64/jre1.6.0_30/bin/java                2000      manual mode
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode

Press enter to keep the current choice[*], or type selection number:

$ update-alternatives --config javaws
There are 2 choices for the alternative javaws (providing /usr/bin/javaws).

  Selection    Path                                              Priority   Status
------------------------------------------------------------
* 0            /opt/java/64/jre1.6.0_30/bin/javaws                2000      auto mode
  1            /opt/java/64/jre1.6.0_30/bin/javaws                2000      manual mode
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws   1061      manual mode


craig10x
Level 7
Level 7
Posts: 1576
Joined: Fri Jul 03, 2009 12:44 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby craig10x » Fri Feb 24, 2012 7:23 pm

Thank you so much for posting this...i've been trying to find a deb file for sun-java for the longest time....the funny thing is Oracle has an rpm installer on their website but provides no deb file installer....

Though a big mint fan, i am currently using Ubuntu 11.10 and ubuntu no longer provides sun-java at all...and i have some programs that don't work right without it (they only provide the open source version)...

So your tutorial solved my problem....really appreciate this :D

User avatar
mads
Level 6
Level 6
Posts: 1301
Joined: Wed Nov 03, 2010 3:44 pm
Contact:

Re: HOWTO: Install Oracle Java automatically and easily

Postby mads » Fri Feb 24, 2012 7:31 pm

Worked perfect with Mint 12. Thanks. :D

ecosseman
Level 1
Level 1
Posts: 5
Joined: Tue Oct 13, 2009 7:18 am

Re: HOWTO: Install Oracle Java automatically and easily

Postby ecosseman » Sun May 13, 2012 3:24 am

True. Works well with Mint 12. Thanks.

craig10x
Level 7
Level 7
Posts: 1576
Joined: Fri Jul 03, 2009 12:44 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby craig10x » Sun May 13, 2012 9:14 am

Not only that, but the ppa this deb file adds to your update manager gets you the latest versions of it automatically in your updates :D
And this deb file works with ANY DEB distribution... :wink:

User avatar
martindeporres
Level 1
Level 1
Posts: 8
Joined: Thu May 31, 2012 3:09 am

Re: HOWTO: Install Oracle Java automatically and easily

Postby martindeporres » Thu May 31, 2012 3:15 am

doktornotor wrote:1/ Install Oracle Java

Code: Select all

 echo "deb [b]http://www.duinsoft.nl/pk[/b]g debs all" | sudo tee /etc/apt/sources.list.d/oracle-java.list
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26
sudo apt-get update
sudo apt-get install update-sun-jre


The above will automatically download, install and setup Oracle Java from the Oracle site. It also installs a script to /usr/sbin/update-sun-jre which you can use to update the Java when a new version comes out.


Code: Select all

$ sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.PqT0753SJS --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keys.gnupg.net --recv-keys 5CB26B26
gpg: requesting key 5CB26B26 from hkp server keys.gnupg.net
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error


Why?

Is there anybody else having this problem?
When the world isn't the same as our minds believe, then we are in a nightmare. And nothing is worse than a nightmare... except for one you can't wake up from.

Alamo Joe Rogan

craig10x
Level 7
Level 7
Posts: 1576
Joined: Fri Jul 03, 2009 12:44 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby craig10x » Thu May 31, 2012 11:28 pm

Did you put in each line one at a time hit enter and let the terminal do it's thing before putting in the next line?
You can't just copy and paste the whole business in 1 shot...i don't think that would work...

User avatar
martindeporres
Level 1
Level 1
Posts: 8
Joined: Thu May 31, 2012 3:09 am

Re: HOWTO: Install Oracle Java automatically and easily

Postby martindeporres » Fri Jun 01, 2012 12:52 am

craig10x wrote:Did you put in each line one at a time hit enter and let the terminal do it's thing before putting in the next line?
You can't just copy and paste the whole business in 1 shot...i don't think that would work...


I pasted, one line at a time, not the whole block of lines at once.
When the world isn't the same as our minds believe, then we are in a nightmare. And nothing is worse than a nightmare... except for one you can't wake up from.

Alamo Joe Rogan

craig10x
Level 7
Level 7
Posts: 1576
Joined: Fri Jul 03, 2009 12:44 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby craig10x » Fri Jun 01, 2012 9:56 pm

Strange then, that it didn't work for you...i have done it on installed distros, even live isos with no problems at all...worked smoothly ever single time...

User avatar
martindeporres
Level 1
Level 1
Posts: 8
Joined: Thu May 31, 2012 3:09 am

Re: HOWTO: Install Oracle Java automatically and easily

Postby martindeporres » Sat Jun 02, 2012 6:13 am

craig10x wrote:Strange then, that it didn't work for you...i have done it on installed distros, even live isos with no problems at all...worked smoothly ever single time...


ORACLE Java works fine, but...

I had to ignore that error, and I would be happier if the signature could be verified. It's a security concern.

If I type:

Code: Select all

$ sudo apt-get update


At the end of the update I get this line:

Code: Select all

Reading package lists... Done
W: GPG error: http://www.duinsoft.nl debs Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E18CE6625CB26B26


I am not a Linux expert, but I know it's better if the signature is verified. I sent a PM to the original poster, but I haven't received any reply yet.

I am thankful because it works, but I wish the signature would work too. I hope I explained myself well.
When the world isn't the same as our minds believe, then we are in a nightmare. And nothing is worse than a nightmare... except for one you can't wake up from.

Alamo Joe Rogan

craig10x
Level 7
Level 7
Posts: 1576
Joined: Fri Jul 03, 2009 12:44 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby craig10x » Sat Jun 02, 2012 9:36 am

Glad to hear it is working for you...if you check your software sources, if their ppa is listed in there, then you should also get the updated versions through the update manager, automatically...

Not sure why you got those errors while installing...i never experienced that and as i mentioned, i have put that on LIVE iso sessions of ubuntu/mint/etc...aside from actual hard installs, and it always went in perfectly...

I don't think you have to worry about signature identification, though...it is a very legit deb package and i have never had any problems with it :)

User avatar
martindeporres
Level 1
Level 1
Posts: 8
Joined: Thu May 31, 2012 3:09 am

Re: HOWTO: Install Oracle Java automatically and easily

Postby martindeporres » Sat Jun 02, 2012 10:20 am

craig10x wrote:Glad to hear it is working for you...if you check your software sources, if their ppa is listed in there, then you should also get the updated versions through the update manager, automatically...

Not sure why you got those errors while installing...i never experienced that and as i mentioned, i have put that on LIVE iso sessions of ubuntu/mint/etc...aside from actual hard installs, and it always went in perfectly...

I don't think you have to worry about signature identification, though...it is a very legit deb package and i have never had any problems with it :)


I am using Linux Mint Debian Edition, I am not sure, but I think the ppa's are part of Ubuntu.
I checked my /etc/apt/sources.list , and it's not listed there:

Code: Select all

deb http://packages.linuxmint.com/ debian main upstream import
deb http://debian.linuxmint.com/latest testing main contrib non-free
deb http://debian.linuxmint.com/latest/security testing/updates main contrib non-free
deb http://debian.linuxmint.com/latest/multimedia testing main non-free


I am guessing, I will not be getting any updates unless I can solve the signatures issue.
When the world isn't the same as our minds believe, then we are in a nightmare. And nothing is worse than a nightmare... except for one you can't wake up from.

Alamo Joe Rogan

craig10x
Level 7
Level 7
Posts: 1576
Joined: Fri Jul 03, 2009 12:44 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby craig10x » Sat Jun 02, 2012 11:48 am

ahhh...i wasn't aware you were using lmde...that could well be the reason...all the installs i have done with it were on ubuntu based distros...
direct debian distros can be a bit "quirky" with these kind of ppa/deb files...

User avatar
martindeporres
Level 1
Level 1
Posts: 8
Joined: Thu May 31, 2012 3:09 am

Re: HOWTO: Install Oracle Java automatically and easily

Postby martindeporres » Sat Jun 02, 2012 3:37 pm

craig10x wrote:ahhh...i wasn't aware you were using lmde...that could well be the reason...all the installs i have done with it were on ubuntu based distros...
direct debian distros can be a bit "quirky" with these kind of ppa/deb files...


I actually tried this because the original poster wrote:

doktornotor wrote:The below is only tested on LMDE, not sure how/whether it works on Ubuntu Mint editions.


I'm still waiting for doktornotor's feedback.
When the world isn't the same as our minds believe, then we are in a nightmare. And nothing is worse than a nightmare... except for one you can't wake up from.

Alamo Joe Rogan

doktornotor
Level 4
Level 4
Posts: 212
Joined: Mon Jan 23, 2012 6:28 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby doktornotor » Sun Jun 24, 2012 6:09 am

As for the GPG key, the original instructions are just enough. If this does not work for you for whatever weird reason, use an alternative keyserver as advised at http://www.duinsoft.nl/packages.php

About Ubuntu - no idea, not using and do not ever plan on using.

User avatar
Garvan
Level 4
Level 4
Posts: 296
Joined: Sun May 29, 2011 3:26 am
Location: Lao PDR
Contact:

Re: HOWTO: Install Oracle Java automatically and easily

Postby Garvan » Sun Jun 24, 2012 8:49 am

Thank you. I might have figured it out for my self, but you saved me an hour.

Garvan
Notebook: HP 14 Notebook PC 14-r003TX, i5-4210U @ 1.7 GHz, 8GB RAM, Linux Mint 17.2 (Dual boot with Win 10)
Notebook: DELL latitude E5520, i5-2520M @ 2.50 GHz, 4GB RAM, Linux Mint 17.2

grizzler
Level 5
Level 5
Posts: 599
Joined: Wed Jun 15, 2011 5:19 pm
Location: The Hague, NL

Re: HOWTO: Install Oracle Java automatically and easily

Postby grizzler » Sun Jun 24, 2012 1:26 pm

The update-sun-jre script should work with all or at least most Debian based distributions. It was created as an alternative to the manual instructions on this page, at the request of the author of that page.

alborz
Level 1
Level 1
Posts: 3
Joined: Wed Sep 05, 2012 7:23 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby alborz » Wed Sep 05, 2012 7:36 pm

Very easy steps, thanks a lot doktornotor. I used to do a lot of manual stuff to get oracle java work before :D

chatan
Level 1
Level 1
Posts: 2
Joined: Fri Mar 08, 2013 10:28 pm

Re: HOWTO: Install Oracle Java automatically and easily

Postby chatan » Wed May 22, 2013 8:21 am

I did not try it, but the method in orignal post seems very similar to the method i've used in MEPIS and what worked for me here on Linux Mint KDE 14:
(Note 1: these step are found at MEPIS wiki: http://www.mepis.org/docs/en/index.php? ... va_How-tos )
(Note 2: MEPIS doesn't use sudo, but I guess sudo could be substituted. but these su -c commands worked on Linux Mint just fine)

1) Add the repository and import the GPG key with the following konsole commands:

su -c 'touch /etc/apt/sources.list.d/oracle-java.list'
su -c 'echo "deb http://www.duinsoft.nl/pkg debs all" > /etc/apt/sources.list.d/oracle-java.list'
su -c 'apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26'

2) To install the script, open Synaptic, click Reload, and then search for and install "update-sun-jre" That's it. Now you have installed the latest version of the Oracle Java Runtime Environment. There is no need to further configure Java with "update-alternatives --config" commands or create a symlink in the Firefox's plugin directory. To open Java Control Panel open Kickoff and type 'java' in the search box.


Cheers


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 5 guests