In this post I will show you how to install JDK7 in Ubuntu without using PPA. The thing with PPA is that you can not always trust the source. To begin, we need to download the JDK7 package (compressed tar) from Oracles website.

From the JDK download select the Linux tar.gz file. I am using an x86 machine. So I will download the the i586.tar.gz version.

When prompted save the file some where appropriate. I am will save it to the Downloads folder in my home.

Next extract the downloaded package using the following command:

tar -xvf ~/Downloads/jdk-7u17-linux-i586.tar.gz

Next create a folder to host the JDK by running the following command

sudo mkdir -p /usr/lib/jvm/jdk1.7.0_17

The move all the content of the extracted file to the location we create above by running the following command:

sudo mv jdk1.7.0_17/* /usr/lib/jvm/jdk1.7.0_17/

Next run the following commands to make the javac, java, and javaws available system wide.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_17/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_17/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_17/bin/javaws" 1

Next create a mozilla plugin folder in your home direcory

mkdir ~/.mozilla/plugins/

Finally, create a symbolic link to your Mozilla plugins folder. For 64-bit systems, replace ‘i386’ with ‘amd64’.

ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/

That is that, Happy coding with Java

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s