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

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

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

How to Install LAMP Stack on Linux - Centos 7

Installing Docker-Compose on Ubuntu

Apache Tomcat Installation - Ubuntu - 17.04

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

Blog Top Sites

Blog Log