Set Java 8 Environmental Variable Path On Redhat / CentOS

Here, I’m going to show you how to set java 8 environmental variable path on the Linux machine. This is very important in order to run the java code or compile them. you need to do this sometimes because it also depends on the application and should be properly set.

We have to install a version according to the application requirements otherwise apps can’t work. Java is a powerful language in software development. it includes lots of libraries which require application and software.

Set Java 8 Environmental Variable Path:

Java mostly used in all the application and web development. To make 
it work properly, you need to set the java path in the Linux machine. 

Check Out: Install Java 8

Installation of Java Path  

Step 1: Location of java installed is /usr/java/

Set Java 8  Environmental

Now You will have to find it, .bashrc 

Check Out: How To Install Podman and Run Container On Linux 8

Step 2: You can find that file by command ls -a

set java path linux

Here you have to put these settings to set the java path

Go the file vim ./.bashrc

set environment variable linux

Check Out: Could Not Find Driver With Class Name: com.mysql.jdbc

Step 3: Put these lines  and Set the path for JDK

export  JAVA_HOME=/usr/java/jdk1.8.0_171
export  PATH=$PATH:JAVA_HOME/bin

java path in linux

Step 4: Run this command to reload the .bashrc file

source /root/.bash_profile

set environment variable linux

Check Out: Check Service Is Running Or Not

Step 5: Verify path set using the below command

echo “JAVA_HOME”

If the path is set properly, it will show you output otherwise it’s blank output.

Now JAVA path is set successfully. You can see the output.

That’s it. java path in linux set environmental variable linux

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment