0% found this document useful (0 votes)
366 views3 pages

How To Remove OpenJDK 7 JRE From Linux Mint 17.1

The document describes steps to remove the default OpenJDK 7 JRE from Linux Mint 17.1 and replace it with Oracle's Java 8. It involves downloading and installing Oracle JDK 8, removing the OpenJDK 7 packages using Synaptic Package Manager, creating a link to Oracle's Java plugin for Firefox, setting environment variables to point to the new JDK installation, and verifying the Java version.

Uploaded by

April Cole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
366 views3 pages

How To Remove OpenJDK 7 JRE From Linux Mint 17.1

The document describes steps to remove the default OpenJDK 7 JRE from Linux Mint 17.1 and replace it with Oracle's Java 8. It involves downloading and installing Oracle JDK 8, removing the OpenJDK 7 packages using Synaptic Package Manager, creating a link to Oracle's Java plugin for Firefox, setting environment variables to point to the new JDK installation, and verifying the Java version.

Uploaded by

April Cole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

0

More

Next Blog

Create Blog Sign In

Ridzwan's Blog
Thursday, January 29, 2015

Ridzwan

How To Remove OpenJDK 7 JRE From Linux Mint 17.1


Recently, I became curious as to whether it was possible to delete the default OpenJDK 7 JRE
and switch to totally using Oracle's Java - including using Oracle's Java plugin for Firefox. This blog
describes my experience with this effort, and the short answer is "Yes - it is possible". Here is
how:
STEP 1: First you have to download the latest version of Oracle's Java SE (aka JDK) package and
install it. To do this, first point your Firefox web browser to the Oracle SE download page here and
download the latest version of the 64-bit JDK (not Server JRE or the JRE) - currently at version
8u31 (or 1.8.0_31). It is also recommended that you download the API docs and demos
(+samples) for the JDK - although this is not required for Java program development. Once the
packages have been downloaded, close the Firefox web browser and execute the following
commands:
cd Downloads
tar xzvf jdk-8u31-linux-x64.tar.gz
tar xzvf jdk-8u31-linux-x64-demos.tar.gz
unzip jdk-8u31-docs-all.zip -d jdk1.8.0_31
sudo mv jdk1.8.0_31/ /usr/lib/jvm/
sudo chown -R root:root /usr/lib/jvm/jdk1.8.0_31
cd ~
The above steps will uncompress the files downloaded to a 'jdk1.8.0_31' directory in the
'Downloads' folder. The 'jdk1.8.0_31' directory will then be moved to /usr/lib/jvm, where all the
current Java files reside. The owner:group will then be set to 'root'.
WARNING: If you do not move the 'jdk1.8.0_31' directory to /usr/lib/jvm directory now, then the
/usr/lib/jvm directory will be removed when you remove OpenJDK 7 later.
STEP 2: Then we have to remove the IcedTea plugin from Firefox. If you launch Firefox now, and
type "about:plugins" in the location (URL) bar, it will show that 'IcedTea-Web Plugin (using
IcedTea-Web 1.5 (1.5-1ubuntu1))' is one of the plugins installed. It will not be possible to remove
this plugin using Firefox's -> Tools -> Add-ons as this plugin was installed by OpenJDK itself. So
we have to turn to the Synaptic Packet Manager to do the job. Make sure that Firefox is closed,
then launch Synaptic and enter 'icedtea' into the search box. Then mark the following items for
complete removal:
icedtea-7-plugin
icedtea-plugin
icedtea-7-jre-jamvm
icedtea-netx
icedtea-netx-common
Click the 'Apply' button to remove the marked files. You can then check whether the Firefox Java
plugin has been removed by launching Firefox and typing "about:plugins" in the location (URL) bar.
The resulting display should indicate that there is no Java plugin present now. Then close Firefox
again. A quick look into the /etc/alternatives directory will also show that the 'itweb-settings', 'jexec'
and 'mozilla-plugin.so' files has also been removed.
STEP 3: Now we will replace Firefox Java plugin by Oracle's version. Let me stress that this step
is optional - if you wish to test Java applets in Firefox, go ahead and install this plugin - else just
ignore this step.
First check whether there is a sub-directory called 'plugins' under the '.mozilla' directory (a hidden
directory - hence the period before the name) in your home directory. The 'ls -la .mozilla' command
is used to perform this check.
If this directory is not present then create the directory by executing the 'mkdir .mozilla/plugins'
command within your home directory. Once this directory is present, its time to create a link to
Oracle's Java plugin. The name of this plugin is 'libnpjp2.so' and is found in the
/usr/lib/jvm/jdk1.8.0_31/jre/lib/amd64 directory. Execute the following commands:
cd .mozilla/plugins
converted by W eb2PDFConvert.com

ln -s /usr/lib/jvm/jdk1.8.0_31/jre/lib/amd64/libnpjp2.so .
cd ~
Do not forget to include the period (.) in the second last command above. It denotes that the link
will be created in the current directory (.mozilla/plugins). Once this link is created, launch Firefox
again, type 'about:plugins' in the location box and the resulting display will show that Oracle's Java
plugin is present. Also, if you click on Tools -> Add-ons, followed by selecting the 'Plugins' tab,
you will see that the Java plugin is present.

About Me

ridz
Full name: Ridzwan
Abdullah - a retired
IT professional.
View my complete
profile

Blog Archive

2015 (9)
January (9)
Tuning
Rebecca
(Linux Mint
17.1
Cinnamon)
- Part 2...
How To
Remove
OpenJDK 7
JRE From
Linux Mint
17.1

STEP 4: Launch Synaptic again and this time, type 'openjdk' into the search box. Now mark the
following files for complete removal:
default-jre
default-jre-headless
openjdk-7-jre
openjdk-7-jre-headless
openjdk-7-jre-lib

Fixing Oracle
Java
Alternatives
Links on
Linux Min...

Click the 'Apply' button to remove the marked files. If you look into the /usr/lib/jvm directory, you
will find that there is now just one directory there - the one containing Oracle's Java. The files in
the /etc/alternatives directory will no longer contain links to Java.

Upgrading
Oracle JDK
8 on
Windows
Upgrading
Oracle JDK
8 on Linux
Mint 17.1

NOTE: If you have set up links previously, you can now remove those links using the 'updatealternatives --remove-all itemname' (where itemname is the name of the Java link you wish to
remove). Just make sure that you only remove the Java related links - removing other non-Java
links may harm the whole system. It is safe to remove these links as there is one Java installed Oracle's SE 8. The list of the files are:

Tuning
Rebecca
(Linux Mint
17.1
Cinnamon)
- Part 1...

java
javaws
keytool
orbd
pack200
policytool
rmid
rmiregistry
servertool
tnameserv
unpack200

How to Install
Oracle Java
and
Android
Studio on
a...
How To Install
Oracle JDK
7 and
Android
Studio on ...
How To Install
Oracle Java
and
Android
Studio on
W...

STEP 5: Now we have to set the environment variables and paths correctly for the whole system. If
you have already set these variables previously, then you can safely skip this step. If not, execute
the following command:
sudo nano /etc/profile

2014 (7)
2013 (1)

This will execute the nano text editor and open the /etc/profile file for editing. Now add the following
lines at the end of the file.

2012 (18)
2011 (4)

export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_31
export PATH=$PATH:$JAVA_HOME/bin

2010 (8)
2009 (21)

Save the file and close it. Note that, upon system startup, these will set the JAVA_HOME and
PATH environment variables for the whole system. The JAVA_HOME environment variable points
to the JDK root while the PATH environment variable will add the /bin directory of the JDK to
whatever path that has already been specified. This will enable the 'javac' command to be executed
from any directory. Now log out and then log in again to the system in order to make sure that both
the environment variables are set.

Followers

STEP 6: Check that you have correctly installed Oracle Java by executing the commands:
echo $JAVA_HOME
echo $PATH
java -version
javac -version
If you see the string 'jdk1.8.0_31' in the output to the above commands, then you have
successfully removed OpenJDK 7 JRE and replaced it with Oracle SE 8.
Now whenever Oracle issue an updated version, all you have to do in order to use the new version
of Java SE is to follow STEP 1, STEP 3 and STEP 5 above. Just make sure that you change the
version number to the new version in the commands. No more messing around with 'updatealternative' commands - and that alone make this whole exercise worthwhile. Happy computing!

Posted by ridz at 9:03 AM


Labels: Linux Mint 17.1, OpenJDK 7 removal, Oracle Java, Oracle JDK 8

converted by W eb2PDFConvert.com

No comments:
Post a Comment
Enter your comment...

Comment as: Select profile...

Publish

Preview

Newer Post

Home

Older Post

Subscribe to: Post Comments (Atom)

Simple template. Powered by Blogger.

converted by W eb2PDFConvert.com

You might also like