分享

How To Install JAVA ( OpenJDK ) on Ubuntu

 simplelam 2014-05-26
In this article I am going to install JAVA (OpenJDK) on Ubuntu 12.04 LTS system. Use below simple steps to install. read more about java
Step 1: Search OpenJDK Packages

Use apt-cache command to search available java version to install.

 
$ apt-cache search openjdk

default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
default-jdk - Standard Java or Java compatible Development Kit
default-jre - Standard Java or Java compatible Runtime
default-jre-headless - Standard Java or Java compatible Runtime (headless)
freemind - Java Program for creating and viewing Mindmaps
icedtea-7-jre-jamvm - Alternative JVM for OpenJDK, using JamVM
icedtea-7-plugin - web browser plugin based on OpenJDK and IcedTea to execute Java applets
jtreg - Regression Test Harness for the OpenJDK platform
openjdk-7-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-7-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-7-doc - OpenJDK Development Kit (JDK) documentation
openjdk-7-jdk - OpenJDK Development Kit (JDK)
openjdk-7-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-7-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-7-jre-lib - OpenJDK Java runtime (architecture independent libraries)
openjdk-7-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-7-source - OpenJDK Development Kit (JDK) source files
uwsgi-app-integration-plugins - plugins for integration of uWSGI and application
icedtea-7-jre-cacao - Transitional package for obsolete Cacao JVM for OpenJDK
java-package - Utility for creating Java Debian packages

As per above output you can see openjdk-7-jdk is available in package manager.

Step 2: Install JAVA (OpenJDK)

Use below command to install JAVA using package manager.

$ sudo apt-get install openjdk-7-jdk
Step 3: Verify JAVA Version

After installation of Java use below command to verify the installed version of JAVA.

$ java -version

java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2)
OpenJDK Client VM (build 24.45-b08, mixed mode, sharing)
root@ubuntu:~# 

Step 4: Setup JAVA_HOME Environment Variable

Its the best practice to set Java environment variable after installing java. To setup JAVA_HOME add following line to ~/.bashrc file, Path may be differ with your system architecture.

$ echo "export JAVA_HOME=\"/usr/lib/jvm/java-7-openjdk-i386/\"" >> ~/.bashrc
$ source ~/.bashrc

Use following command to check the environment value

$ echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk-i386/

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多