Sunday, November 7, 2010

Installing JDK and JRE in UBUNTU Linux



You need to follow some simple steps for installing Sun Java Development Kit(JDK) & Java Runtime Environment(JRE) in Ubuntu Linux. They are:

Step 1: At the initial stage ,check whether the MULTIVERSE repository is enabled or not.
For this Click on 
System->Administration->Software Sources->Select Multiverse->Close.

Step 2: Open TERMINAL and type the following to install JDK and JRE :sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
Note: (1):
If you want to use red hat interface , press Ctrl+Alt+F1 and enter the user name and password. For returning to the previous interface , press Ctrl+Alt+F7.(2):You may need to update the runtime or development kit for the java language. For updation typesudo update-java-alternatives -s java-6-sun at the terminal.


Step 3: Set up the environment variable.
For this , do the following:
Type the following at the terminal:
vi $HOME/.bash_profile
Type the following in the opened text file:
export JAVA_home=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin
Save and close the file. For this , press 
ESC and type :wq and press enter.
Warning: Linux is case-sensitive.So,take care of the case of the command entered.

Note: If you want to know the version of JRE installed , use the following command :
java -versionFOR COMPILING THE JAVA PROGRAM , GO TO THE SPECIFIED DIRECTORY AND TYPE
JAVAC FILENAME.JAVAFOR EXECUTING THE PROGRAM , TYPE
JAVA FILENAME

No comments: