Install JDK on Ubuntu

Installing Open JDK from Command Prompt

Issue command apt-get install openjdk-7-jdk to install JDK7. Ubuntu will auto download JDK and start the installation, wait a few minutes for the downloading process.

umasarath@ubuntu:~$sudo apt-get install openjdk-7-jdk

Verifying Java after installation

Ubuntu installs JDK at /usr/lib/jvm/jdk-folder, for example /usr/lib/jvm/java-7-openjdk-amd64/. In additional, Ubuntu also puts the JDK bin folder in the system path, via symbolic link. 
For example, /usr/bin/java.


To verify if JDK is installed properly, type java -version in the command prompt.


umasarath@ubuntu:~$java-version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
umasarath@ubuntu:/usr/lib/jvm/java-7-openjdk-amd64/bin$
Post-Installation Setup


To configure JAVA_HOME in system path each time the terminal is started, you can append the export JAVA_HOME to /etc/profile or .bashrc.


umasarath@ubuntu:~$ echo $JAVA_HOME
####shows nothing
 
umasarath@ubuntu:~$ sudo echo "export JAVA_HOME=\"/usr/lib/jvm/java-7-openjdk-amd64/\"" >> ~/.bashrc
####restart terminal
 
umasarath@ubuntu:~$ echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk-amd64/

You are done with Java Installation on Ubuntu. :)

Comments

Popular posts from this blog

[SOLVED] - RSYNC not executing via CRON

RSYNC command without authentication - 8 simple steps