THE IT IDEAS

  • Home

Tuesday, 25 November 2014

How to install Oracle JAVA JDK with apt-get command

 THE IT IDEAS     17:04     java   


Installing Oracle JAVA JDK

Run below command to one by one to install JAVA JDK.

#apt-get install python-software-properties
#add-apt-repository ppa:webupd8team/java
#apt-get update


To Install JDK6 Run below Command

#apt-get install oracle-java6-installer

To Install JDK7 Run below Command

#apt-get install oracle-java7-installer

To Install JDK8 Run below Command

#apt-get install oracle-java8-installer

Installation of JAVA JDK is Over !!!




Managing Java
When there are multiple Java installations on your ubuntu, the Java version to use as default can be chosen. To do this, execute the following command:

#update-alternatives --config java

It will usually return something like this if you have 2 installations (if you have more, it will of course return more):

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      auto mode
  1            /usr/lib/jvm/java-6-oracle/jre/bin/java          1061      manual mode


Press enter to keep the current choice[*], or type selection number:


You can now choose the number to use as default. This can also be done for the Java compiler (javac):

#update-alternatives --config javac

It is the same selection screen as the previous command and should be used in the same way. This command can be executed for all other commands which have different installations. In Java, this includes but is not limited to: keytool, javadoc and jarsigner.
Setting the "JAVA_HOME" environment variable

To set the JAVA_HOME environment variable, which is needed for some programs, first find out the path of your Java installation:

#update-alternatives --config java

It returns something like:

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      auto mode
  1            /usr/lib/jvm/java-6-oracle/jre/bin/java          1061      manual mode

Press enter to keep the current choice[*], or type selection number:

The path of the installation is for each:

    /usr/lib/jvm/java-7-oracle

    /usr/lib/jvm/java-6-oracle

Copy the path from your preferred installation and then edit the file /etc/environment:

#nano /etc/environment

In this file, add the following line (replacing YOUR_PATH by the just copied path):

JAVA_HOME=/usr/lib/jvm/java-7-oracle

That should be enough to set the environment variable. Now reload this file:

#source /etc/environment

Test it by executing:

#echo $JAVA_HOME
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

Like Us !!!

Recent Posts

Blog Archive

  • ►  2016 (1)
    • ►  April (1)
  • ►  2015 (12)
    • ►  August (1)
    • ►  May (2)
    • ►  April (8)
    • ►  March (1)
  • ▼  2014 (23)
    • ►  December (8)
    • ▼  November (12)
      • How to setup Network Configuration in Ubuntu Serve...
      • Amazon RDS Restore MySQL Backup with functions
      • How to install Tomcat in Ubuntu
      • How to install Oracle JAVA JDK with apt-get command
      • How to set environment Variable permenantly in MAC...
      • How to Mount AWS S3 Bucket into AWS EC2 Instance (...
      • How to change DocumentRoot path in Apache Ubuntu 1...
      • How to Benchmarking Webserver
      • How to Choose AWS EC2 Instance
      • SCP Command Example
      • MySQL Basic Commands for Linux
      • How to enable mod rewrite module in apache2
    • ►  April (2)
    • ►  March (1)
  • ►  2013 (7)
    • ►  December (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (3)
  • ►  2012 (15)
    • ►  December (6)
    • ►  November (9)

Categories

apache2 EC2 error mysql php ubuntu aws aws rds browser github installation linux mount s3 AWS Bucket CentOS Computer DocumentRoot change How to Benchmarking Webserver IP LAMP Restart Computer SCP command SQL SERVER XRDP administrator amazon rds backup basic commands chat command line disable download drupal ec2.chroot environment external storage device fstab functions geoip gmail google home page iis instance internet java mod rewrite mongodb multiple login network password one password php5 php5-fpm php7 private browsing python repair filesystem repo reset password rhel sa password same computer script sftp share skype ssh tomcat ubuntu 16.04 ubuntu16 visudo windows 8 youtube
JobsMagBlogJobsMag.InThingsGuide

Popular Posts

  • Create SFTP User with chroot in AWS EC2
    Create User with below command #adduser --shell=/bin/false theitideas Provide permission of home directory #chown root:theitideas /ho...
  • How to Surf Privately in Google Chrome
    First open the Google Chrome  Click on Customize and Control Google Chrome at Right hand top as below Now Click on New incognito W...
  • How to enable built-in Administrator account in Windows 7 ?
    How to enable built-in Administrator account in Windows 7 ? First you’ll need to open a command prompt in administrator mode by right...

Copyright © THE IT IDEAS | Powered by Blogger