How to install Java 1.7 for Ubuntu/Debian (apt-get) and Fedora (rpm)

August 10, 2011 by

Many apps, applets, games, and more are written in, or use Java to run. Java is very important, and widely-used. With this article, I will show you how to install the latest JRE/JDK (1.7.0) on Ubuntu/Debian, and Fedora.

original article here:
and 64 bit java install directions from Oracle


1. Download the JRE (Java Runtime Environment) / JDK (Java Development Kit) 7 from here:

The file type for Ubuntu is the .tar.gz
Note: The JDK is for developers. Do not download unless you plan on programming in Java.

2. Unpack (or untar, or extract) the .tar.gz file in the desired directory. Type:

tar -zxvf filename

3. Install Java 1.7 to alternatives. Type:

sudo update-alternatives --install /usr/bin/java java /your/java/directory/jre/bin/java 3

Note: Replace /your/java/directory/, with the directory where you extracted the .tar.gz

4. Choose your Java version using alternatives. Type:

sudo update-alternatives โ€“config java

Then choose the option that points to your Java 7 directory.

Note: If you have chosen the JDK, your javac will not be updated. Typing the javac -version command will return the previous Java’s version javac. I do not know how to fix this.

5. Configure the Java browser plugin.

You will have to use a symbolic link to configure the plugin.


ln -s /your/java/directory/jre/lib/your system architecture/libnpjp.so /your/brower/plugins/directory

Note: /your/java/directory/ is wherever you extracted the .tar.gz

Also, /your system architecture/ is the architecture type of the Java .tar.gz file you downloaded. This will either be i386, or amd64. If you are unsure which, open a file manager, go to your Java directory, and go to the jre/lib/ directory. If a folder entitled amd64 is there, you have the x64-bit version. If not, you have the x32-bit.

Another thing to note, the /your/browser/plugins/directory/ is your browser’s plugins directory. Example: if you are using Mozilla’s Firefox, your plugins directory is /usr/lib/mozilla/plugins/

6. Test the plugin. Restart your browser, and go to

Java Tester

Click the Java Version button. If the pink box says Java 1.7.0 from Oracle, you have configured the plugin correctly.

Installing Java 1.7 goodness for Ubuntu. Enjoy ๐Ÿ™‚


1. Download the .rpm installer from Oracle here:

2. Install. You can do this by:

A) Using the Open With feature of your browser

B) Going to the directory of the download in a file browser, right-clicking the file, and selecting the Open with Software Install option

C) Typing (as root)

rpm -ivh filename

The browser plugin should be configured by the installer.

Java 1.7 goodness for Fedora. Enjoy ๐Ÿ™‚


6 Responses to How to install Java 1.7 for Ubuntu/Debian (apt-get) and Fedora (rpm)

  1. joeSchmoe

    Thanks for the tutorial. It worked.
    To fix the javac problem you simply initiate the following commands.
    sudo update-alternatives –install /usr/bin/javac javac /your/java/directory/bin/javac 3


    sudo update-alternatives –config javac

    Then choose the option that points to your Java 7 directory.

  2. Johana

    This is stupid!
    Oracle should just provide an install package or a script. Something that actually WORKS!

    I don’t want to figure out all of these inane details or get it wrong and mess up my Linux install every time I need to upgrade the JRE.

Leave a Reply

Your email address will not be published. Required fields are marked *