Installing and Setting JAVA_HOME environment in Linux - Source Installation

     In this article we are going to see how to install different Java version on your linux system and also how to make it as a default one.

Installing through yum:

    When we install java directly the current version is JDK-1.8.0_181



    To check the version of the Java use the below command,









    We can run our applications on different Java versions through source installation.


Installing through source:

    Download the latest file from the official site. Click the following link for downloading the latest version ORACLE.COM. You have to accept the License Agreement to get the download link for the required version.

Note: You cannot download the package through wget. It is recommended to download the package on your system and scp the tar file to the required server.

Untar the file:



Move the extracted file to /usr/local/ directory,



Export the JAVA_HOME and PATH to the installed JDK,



To check the Java path try echo command,





    Now we have all set to run the application through the installed java by mentioning the Java path on the application's bin file.

    Java file path will be /usr/local/jdk1.8.0_191

Setting the default Java and Java Environment to the installed JDK:

    Before pointing the java to the souce installation file, unlink the existing java on /usr/bin which was installed through yum.





Create a symlink on the /usr/bin/ directory for java and set the path to the installed JDK file,



    Now your server's default java will be jdk1.8.0_191, check the version of java.










    Feel free to ask if you have any questions.

Comments

Popular Posts on this blog

How to Install LAMP Stack on Linux - Ubuntu 17.04

Creating and Running Virtual Machines in LINUX - KVM - Cli Mode

Apache Webserver - Installation from source (tar.gz and tar.bz2)

Replacing Commands for Linux Files - Using Perl and Sed

How to install Docker on Ubuntu-17.04

Setting up a Mail server using Roundcube - Part-3 - Centos 7

Blog Top Sites

Blog Log