Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Please tell me how to set environment variables


I installed Java via terminal apt-get command, Tomcat and Eclipse by downloading tar.gz files and extracting them. Maven also by terminal and by getting plugin to eclipse too.

Please tell me a answer step by step. I'm beginner to Ubuntu.

share|improve this question

migrated from May 19 '11 at 23:01

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Go to a terminal and type :

export JAVA_HOME=/usr/lib/jvm/java-6-sun

and consequently for the others

Don't forget these values will be only available in your current terminal session. You'll have to add these to a persistent environnement file like ~/.bashrc or ~/.zshrc to keep them among a terminal session restart

To check for existing variables, type env

share|improve this answer
thanks dear it solved.. – djPriyan May 19 '11 at 14:35

It's not really clear whether you want to set from a program or what, but, in a bash shell, the syntax is: export JAVA_HOME=/path/to/JDK

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.