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 http://archive.canonical.com/ 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:

Get back the command prompt in Windows 10

If you've updated your Windows 10 system to the Creators Update (or newer), you may have noticed that the contextual menu (shift+right c...