Sunday, 24 January 2010

Ubuntu Linux: Install Sun's Java JDK

If you're using Debian (this works with Ubuntu as well, and may work with other Debian derivatives) and want to install Sun's Java Development Kit, and ensure it is set properly.
First, let's start by opening a terminal. Remember to use su or sudo for admin tasks.
sudo apt-get install sun-java6-jdk -y
You'll be asked to accept the accept the license terms before installing the JDK.
After all is done, type the following to test your JDK:
java -version
javac -version
Many Linux distributions come with other versions of the JRE (runtime environment). If this is the case, use the following terminal commands to choose which want to use as default:
update-alternatives --config java
update-alternatives --config javac
The first line lets you choose a JRE and the second, a compiler (provided more than one alternative is installed).

Notes: You need the nonfree/multiverse repository(-ies) enabled. OR, if you're using Ubuntu 10.04 onwards, the "partner" repository (Sun's/Oracle's Java packages have been moved to partner). Via command line, you may easily do this by pasting the following line in your terminal:

sudo add-apt-repository “deb maverick partner”
sudo apt-get update
 If you're using Ubuntu 10.10, the word in bold should be maverick; for 10.4, use lucid.

No comments:

OOP Principles and UML

These are my favourite explanations (so far) regarding the principles of OOP: Abstraction, Encapsulation, Inheritance and Polymorphism. They...