From Mageia wiki
Revision as of 12:26, 31 December 2015 by Filip (talk | contribs) (adding Java control panel part)
Jump to: navigation, search
this page is a draft.
It requires improvements. If you want to improve it, simply log in and click on the Edit tab.

Please remove this {{Draft}}template, when you're sure the page is complete and correct.


View the other draft pages, or other pages to improve and maintain.

Installing Oracle Java in Mageia

Oracle java logo.png

As you may be aware, the Java version from Oracle Corporation is not available in Mageia due to licensing problems. Some applications, on websites for example, need Oracle's Java, even if you have java-1.7.0-openjdk installed on your Mageia.

For example: https://as.photoprintit.com/web/84012167/startClient.do?client=java&type=print

This tutorial aims to help you install and configure Java SE 7 from Oracle Corporation.

http://www.java.com/

http://java.com/fr/download/linux_manual.jsp?locale=en

Installation

Download Java SE 7 from the official website (for this tutorial, jre-7u9-linux-x64.rpm has been used): http://java.com/fr/download/linux_manual.jsp?locale=en

For 32bit systems

Old version : jre-7u9-linux.rpm http://javadl.sun.com/webapps/download/AutoDL?BundleId=69464

For 64bit systems

Old version : jre-7u9-linux-x64.rpm http://javadl.sun.com/webapps/download/AutoDL?BundleId=69466

Once the file is downloaded, install it by double clicking on it in your favourite file manager.

Configuration

You must now tell the system and your Internet browsers that the new version should be used by default.

Creating a symbolic link from Java to directory

You can use your file manager to create links, but because there are so many different file managers, we shall describe only the command line method as this will work with any Mageia installation. Simply copy and paste the following command into a console as root:

ln -s /usr/java/default /etc/alternatives/

The following command will create a symlink from default to /etc/alternatives/ in the directory /usr/lib/jvm/:

ln -s /etc/alternatives/default /usr/lib/jvm/

Defining the default Java version

Enter the command:

update-alternatives --config java

That should result in something like the following:

 Selection    Command
-----------------------------------------------
*+    1        /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
      2        /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

Enter to keep the default[*], or type selection number:

java-jre-7u9 is not yet present in the list, so this command will add it:

update-alternatives --install /usr/bin/java java /usr/lib/jvm/default/bin/java x

default designates the directory just made with the symlink.

x is the number to attribute in the plugins list. Use the next free number on the list or "1" if there is nothing already in it. In our case, we need to enter "3".

We can check that our Java is present by bringing up the list again:

update-alternatives --config java

The result should be similar to this:

 Selection    Command
-----------------------------------------------
*+    1        /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
      2        /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
      3        /usr/lib/jvm/default/bin/java

Enter to keep the default[*], or type selection number:

You can now enter the number x (3 in our case) to select it as default Java program.

You should now get:

Using `/usr/lib/jvm/default/bin/java' to provide `java'.

You can check that the version is being used by the system:

java -version

On the example system we get:

java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)


Enabling the Java plugin in web browsers

The hardest part is done. Now all we have to do is make your favourite web browser use the Java you just worked so hard to install.

So far, we have tested the plugin with Firefox and Google Chrome.

Mozilla Firefox

Open a console, become root and enter the command:

ln -s /usr/lib/jvm/default/lib/amd64/libnpjp2.so /usr/lib64/mozilla/plugins/

If you downloaded the Java 32bit version and that you use a 32bit system, enter the following command:

ln -s /usr/lib/jvm/default/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins/

Check your Firefox Add-On's Manager (under Tools). You may need to disable the "Iced Tea Web Plug-in" in Firefox in order to get it to use the Oracle Java version.

Google Chrome

Open a console, become root and enter the command:

ln -s /usr/lib/jvm/default/lib/amd64/libnpjp2.so /opt/google/chrome/

If you downloaded the Java 32bit version and that you use a 32bit system, enter the following command:

ln -s /usr/lib/jvm/default/lib/i386/libnpjp2.so /opt/google/chrome/
  • Note: At least one Mageia user found he had to make a "plugins" directory and put the symbolic link into /opt/google/chrome/plugins/.

Checking that your configuration works

Now we are going to check that the Java SE 7 Update 09 plugin is properly installed and is working in your browser.

Click on the following link: http://www.java.com/en/download/testjava.jsp

This will take you to Oracle's Java check page, which should inform you that you are indeed using Oracle Java.

If your browser plugin list shows the free IcedTea-Web plugin as enabled, we strongly recommend that you disable it (do not uninstall it) in order to avoid any conflict or problem between the two plugins.

Enabling Java Webstart

To enable Java Webstart you must add it to the applications list javaws in a console as root:

First, check if javaws is present in the applications list:

update-alternatives --config javaws

On our example system we get:

No alternatives for javaws

We can see there is no present javaws application, so, we shall add it with the following command:

update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/default/bin/javaws x

default: stands for the previously created folder.

x: stands for the figure to attribute in the available Javaws applications list. If the previous list was not empty, replace the final x = chosen number + 1. For example, if the last number of the list was 2, replace x after javaws by 3.

Check now that the javaws application is indeed in the list and selected by default:

update-alternatives --config javaws

That command should return:

There is only 1 program which provides javaws
(/usr/lib/jvm/default/bin/javaws). Nothing to configure.

Enter the figure matching the line /usr/lib/jvm/default/bin/javaws (any in my case since it is the only one) then press the return key and you're done.

Java updating

To update Java you download the latest available rpm version for your architecture and install it: http://java.com/en/download/linux_manual.jsp?locale=en

32bit package

Latest recommended version: jre-7u21-linux.rpm http://javadl.sun.com/webapps/download/AutoDL?BundleId=76850

64bit package

Latest recommended version: jre-7u21-linux-x64.rpm http://javadl.sun.com/webapps/download/AutoDL?BundleId=76852

Note:
You do not need to go through all the above configuration steps again. Once it's done, it should continue to work.

Written by: david.david, On 28/OCT/2012 Translated from http://www.mageialinux-online.org/wiki/activer-java-d-oracle-sur-mageia

Starting Java control panel

To run java control panel you can use

jcontrol

You can configure oracle java, add certificates...