How to install Java for openSUSE and Fedora

Back to the home page

Are you visiting this website with Chrome or Chromium? Then you may see an unjustified warning.

Note: this how-to is written for openSUSE, but can also be used in Fedora, CentOS and Scientific Linux. The tutorial for Ubuntu, Linux Mint and Debian can be found here.

Oracle (Sun) Java: removed from all repositories

1. Oracle (Sun) Java Runtime Environment (JRE) has been removed from the official software repositories of openSUSE. The reason: license trouble. Luckily, its open source brother OpenJDK (and the IcedTea plugin) is a good alternative, for many people at least.

OpenJDK and the IcedTea plug-in are installed by default. They are available in the regular openSUSE repositories and receive regular security updates. OpenJDK and the Icedtea Plug-in are fine for many people.


How-to for Oracle (Sun) Java JRE

2. However, some openSUSE users will still need Oracle (Sun) Java JRE. For those I have written this manual.

Tip: for Ubuntu, Linux Mint or Debian, use this slightly different how-to.

When you want JRE in openSUSE, you can use a manual method. A manual method has the advantage that you don't have to rely on shady third-party repositories, which may be unsafe.

Installing manually is not hard at all, although you have to use the terminal for that (yikes!). Precision is important: it only succeeds when you follow the instructions exactly.

Updates: check for them yourself!

3. A manually installed application receives no updates from openSUSE! For JRE, you'll have to take care of security updates yourself.

For that, you'll regularly want to check the verification website of Java, to see if there are updated versions available. JRE itself won't alert you (it only does that in Windows)

Oracle issues critical security updates on a fixed time schedule (emergencies excepted). On that page, look for the category Oracle Java SE Critical Patch Updates. It may be handy to write those dates in your agenda.

Only for 64 bit

4. openSUSE is nowadays 64-bit. If you're unsure about that, you can check it like this.

Therefore, below you'll only find the instruction for 64 bit.


5. The how-to below relies on copying terminal commands and pasting them into the terminal. Be very careful and precise when you copy/paste them.

Remove the browser plug-in of the old version

5.1. First you'll want to remove the browser plug-in of the old JRE or openJDK (if you have it).

When the old JRE has been installed manually in /opt/java, see the instruction at the bottom of this column (under the header Removal).

When you don't have an old JRE, you probably have openJDK. OpenJDK's web browser plugin (IcedTea) should be completely removed.
Note: leave openJDK itself installed, otherwise malfunctions may occur!

Like this:

Click on Install/Remove Software
Query: icedtea

Mark icedtea-web for removal. This is the web browser plug-in of openJDK.

Press Accept.


5.2. Get the right file from the Java website:

Note: for 64-bit you want Linux x64 (file name ends on .tar.gz).

Do not choose Linux x64 RPM (file name ends on x64.rpm), because I have written this how-to for the .tar.gz file. DO NOT PICK THE RPM, or you won't be able to use this how-to.

Store the file in the folder Downloads. So in:
Firefox puts downloaded files there by default, but not all web browsers do it like that.

For example, user John should place the file in:
When in doubt, check it.

This is important for the terminal commands that you'll execute later on; otherwise they won't be correct.

The how-to continues in the column on the right.

(continued in the column on the right)

This website is being sponsored by Google Ads.

Are you using an ad blocker? Then you're also blocking my earnings from advertisements....

If you wish to support my website, you can configure your ad blocker to make an exception for this website.

Thanks in advance....

Install JRE (64-bit)

5.3. Note: the terminal commands in this how-to possibly refer to an older version of JRE. When there's a newer version, you can simply adapt the file names in the terminal commands.

This how-to has been written for JRE 8 update 144 (64 bit version).

A. Go to the Downloads folder and unpack the compressed JRE file that you just downloaded, with the following combined command:

Type (copy/paste):
cd Downloads && tar -xvzf ~/Downloads/jre-8u144-linux-x64.tar.gz

Press Enter.

B. Now open a terminal and make yourself root in a special and unusual way, namely with preservation of the current user environment variables:
type su -p and press Enter.

Type your password. You won't see anything when you type it, not even dots will show, this is normal. Press Enter.

C. Create a new subfolder in the folder opt, by means of a command:

Type (use copy/paste: rapidly click three times on the blue line, in order to select the entire line).
mkdir -p -v /opt/java/64

Press Enter.

D. Move the unpacked contents of the JRE file into the new system folder that you just created, with the following command:

Type (copy/paste):
mv -v ~/Downloads/jre1.8.0_144 /opt/java/64

Press Enter.

E. Now you'll want to tell the system, that there's a new Java version available:

Type (this is one line, use copy/paste):
update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.8.0_144/bin/java" 1

Press Enter.

Note 1: at this point, you'll probably get this warning:
Absolute path to 'update-alternatives' is '/usr/sbin/update-alternatives', so running it may require superuser privileges (eg. root).
You can safely ignore this: it's simply a result of running su with the parameter -p, which leads the system to think that maybe you're not root after all. But you are, and the job is being done alright.

Note 2: are you updating from a previous Java version, which you have removed manually? Then you'll possibly need to execute the above command twice, in case you'll get another error message the first time.

F. Tell the system, that the new Java must be the default:

Type (copy/paste):
update-alternatives --set java /opt/java/64/jre1.8.0_144/bin/java

Press Enter.

(Like previously, ignore the root message)

G. Installing the Firefox plugin is simple.

By now, su -p has done its part of the job. So first quit the su mode:
Type in the terminal:

Press Enter.

Then execute the following command, in order to create a certain folder (if it doesn't exist already):

Type in the terminal (copy/paste):
mkdir -v ~/.mozilla/plugins

Press Enter.

If it exists already, you'll see a notification of that.

H. Remove an older version of the Java plugin (may or may not be present, but run the command just to make sure).

Type (copy/paste):
rm -v ~/.mozilla/plugins/

Press Enter.

If it's not there to begin with, you'll get a notification of that.

I. Now you can install the plugin, by creating a symbolic link (you tell Firefox, where the plugin is located).

Type (copy/paste):
ln -s /opt/java/64/jre1.8.0_144/lib/amd64/ ~/.mozilla/plugins/

Press Enter.

Close the terminal.

J. Now close and restart Firefox. Check whether everything has succeeded. Type in the URL bar of Firefox (not in the terminal!):


Press Enter.

And scroll down, until you see something approximately similar to this:
Java(TM) Plug-in (followed by a version number)

You can also use this website (note that this website sometimes doesn't work, even when your Java is perfectly alright):

Only enable the plugin when needed

5.4. Java is frequently under attack from malicious software on websites. Java is platform independent, so Linux is vulnerable, too. Therefore it's better to disable the plugin and only enable it for a short while, whenever you need it. You can do that as follows.

Note: this only applies to Java. There's also Javascript, which is much safer. So there's no need to disable Javascript as well.

Tame disk usage with the Java Control Panel

5.5. By default, Java allows itself to use a crazy maximum amount of disk space for the cache (what were the developers smoking?). You can limit that as follows:

Call up the Java Control Panel as follows (in each user account):

Type in the terminal (copy/paste):

Press Enter.

Temporary Internet Files - Settings... Disk Space: limit it to 50 MB.
Click Delete Files... OK - OK - Apply - OK.

Repeat this in each user account, as it's a user preference.

Note: this command is only for JRE 8 update 144. You'll need to adapt it when you use another version.

Other user accounts: repeat three commands

5.6. Are there any other user accounts on the computer? Then repeat the following three commands in each user account:

rm -v ~/.mozilla/plugins/

and then (in case the plugins folder doesn't exist yet):

mkdir -v ~/.mozilla/plugins

and then:

ln -s /opt/java/64/jre1.8.0_144/lib/amd64/ ~/.mozilla/plugins/

Finally, use the control panel in those other user accounts, to limit the maximum disk usage of the cache (see step 5.5).


5.7. Do you wish to remove JRE again? It's very easy, to remove a manually installed JRE. As follows:

a. Open a terminal and make yourself root in a special and unusual way, namely with preservation of the current user environment variables:
type su -p and press Enter.

Type your password. You won't see anything, not even dots, this is normal.
Press Enter.
b. Then remove the folder /opt/java and what's in it. Copy/paste the following command in the terminal:

rm -r -v /opt/java

c. Then remove the Java plugin. Type in the terminal (copy/paste):

rm -v ~/.mozilla/plugins/

Press Enter.

Then close the terminal.

d. Now su -p has done its part of the job. Quit the su mode:

Press Enter.

e. Finally, restart your web browser.

Note: are there multiple user accounts? Then repeat step c in those other accounts (can also be done without root authority).

Updating an older version

5.8. It's easy to update an older version. Proceed as described above, under the header "Removal". Then install the new version.

Want more tips?

6. Do you want more tips and tweaks for openSUSE and Fedora? You can find those here.

To the content of this website applies a Creative Commons license.