+4 votes
1.1k views
in Programming by Expert (5.9k points)
edited by
i have installed ubuntu and now i want to add java and set java home path in linux ubuntu, can you help me?

Thanks for your help!

3 Answers

+2 votes
by (740 points)
edited by
you can open your terminal and past this command

sudo apt-get purge oracle-java7-installer*

and put your password, hit enter Done!

now your java and set java home path in linux ubuntu has been added.
by Expert (5.9k points)
Thanks AsfK +1 from my side :)
0 votes
by Expert (5.1k points)

If you want this environment variable available to all users and on system start then you can add the following code

to /etc/profile.d/java.sh (create it if you want):

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

Then in a terminal run:

sudo chmod +x /etc/profile.d/java.sh
source /etc/profile.d/java.sh
0 votes
by Expert (3.8k points)

If you are having a fresh system I mean you have a new machine and you have Installed Ubuntu now if you want to Install Java so just run this command in terminal :


$ sudo apt-get install openjdk-7-jre

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated