HOWTO: Install Oracle Java automatically and easily

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
doktornotor
Level 4
Level 4
Posts: 203
Joined: Mon Jan 23, 2012 6:28 pm

HOWTO: Install Oracle Java automatically and easily

Post by doktornotor »

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

Re: HOWTO: Install Oracle Java automatically and easily

Post by craig10x »

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
mads

Re: HOWTO: Install Oracle Java automatically and easily

Post by mads »

Worked perfect with Mint 12. Thanks. :D
ecosseman

Re: HOWTO: Install Oracle Java automatically and easily

Post by ecosseman »

True. Works well with Mint 12. Thanks.
craig10x

Re: HOWTO: Install Oracle Java automatically and easily

Post by craig10x »

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:
martindeporres

Re: HOWTO: Install Oracle Java automatically and easily

Post by martindeporres »

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?
craig10x

Re: HOWTO: Install Oracle Java automatically and easily

Post by craig10x »

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...
martindeporres

Re: HOWTO: Install Oracle Java automatically and easily

Post by martindeporres »

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.
craig10x

Re: HOWTO: Install Oracle Java automatically and easily

Post by craig10x »

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...
martindeporres

Re: HOWTO: Install Oracle Java automatically and easily

Post by martindeporres »

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.
craig10x

Re: HOWTO: Install Oracle Java automatically and easily

Post by craig10x »

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 :)
martindeporres

Re: HOWTO: Install Oracle Java automatically and easily

Post by martindeporres »

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.
craig10x

Re: HOWTO: Install Oracle Java automatically and easily

Post by craig10x »

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...
martindeporres

Re: HOWTO: Install Oracle Java automatically and easily

Post by martindeporres »

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.
doktornotor
Level 4
Level 4
Posts: 203
Joined: Mon Jan 23, 2012 6:28 pm

Re: HOWTO: Install Oracle Java automatically and easily

Post by doktornotor »

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: 300
Joined: Sun May 29, 2011 3:26 am
Location: Thailand
Contact:

Re: HOWTO: Install Oracle Java automatically and easily

Post by Garvan »

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

Garvan
Notebook: DELL Latitude E5520, i5-2520M @ 2.50 GHz, 4GB RAM, Linux Mint 17.2 (2011)
Notebook: DELL Latitude 5280, i5-73000 @ 2.7 GHz., 16 GB RAM, Linux Mint 19.2 (2019)
grizzler

Re: HOWTO: Install Oracle Java automatically and easily

Post by grizzler »

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

Re: HOWTO: Install Oracle Java automatically and easily

Post by alborz »

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

Re: HOWTO: Install Oracle Java automatically and easily

Post by chatan »

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
Post Reply

Return to “Tutorials”