Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have never used Ubuntu before. How do I go about setting an environmental variable that points to JDK? I installed it on my Desktop. I typed in "EXPORT JAVA_HOME=~/Desktop/jdk" in the command prompt but it didn't work.

share|improve this question
remove "EXPORT" – Dillmo Jun 30 '13 at 21:38
make export lower case. – ubfan1 Jun 30 '13 at 21:40

set environment variables as follows

Edit the system Path file /etc/profile

sudo gedit /etc/profile

Add following lines in end

export JAVA_HOME
export JRE_HOME
export PATH

for reference

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.