Wednesday 22 February 2017

Change the JAVA_HOME in Ubuntu

Hello All,

Long time break. Sorry for being so. I was equipped with so much new things.
But anyways as we are back, lets begin it from where we left and continue our strive for technology.

A lot of geeks do prefer using open source OS distributions.
And Ubuntu from that perspective is a great choice.

Sometimes i have seen people get stuck with how to set JAVA_HOME in Ubuntu.
Let say you want to change from the previous version 1.7 to 1.8

What would you do in Ubuntu?

Write JAVA_HOME = "Directory for java 1.8" ??
Do you think it will work?

So your plan of action was to
Open Terminal and then
Type JAVA_HOME = "Directory for java 1.8"
And then check the change using echo $JAVA_HOME.

Voila!! It got changed!!

But surprisingly next time you start the system its not gonna work. Oh!! So its valid for the terminal in which you have made the change and its not PERMANENT!!

Yes Geeks!! That's TRUE.

So, now the question is how to make it permanent?
Will go straight to the answer.

Open your terminal(Ctrl+Alt+T)
open environment file in some text editor as change in that file permanently changes the environment variables value. So what to do?
 Type in terminal
It's Very easy to set path in Linux . Do as follows :
Step-1 Open terminal and type sudo gedit .bashrc
Step-2 It will ask you your password . After typing password ,it will open the bash file . Then go to end of the file and type a last line
step-3 export JAVA_HOME= "YOUR JAVA 1.8 DIRECTORY"
step-4 Then save the file and exit from file
And voila!! Its done!!
Check the JAVA_HOME directory now by typing echo $JAVA_HOME

-----------------------------------------------------------------------
Signing off geeks!! :)