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

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 tried to export JAVA, used this

export JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin

It seems like it works just for while, after I close my console have to do this again.. How to install it permanently.

share|improve this question

migrated from Jun 24 '13 at 23:39

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

up vote 2 down vote accepted

@AdamSiemion is close - You should add these lines to ~/.bashrc, which is sourced by interactive shells, while ~/.bash_profile is only sourced by interactive login shells.

cat >> ~/.bashrc <<'EOF'
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin

To verify, open a new shell and echo "$JAVA_HOME".

share|improve this answer
I'm sorry for it. I meant if I have the same problems ocur What I need just add that type of commands to bashrc. Just the reason why I ask because I have Maven - this is tool which manage progects it also was issue like this. – d.v.a Jun 25 '13 at 10:10
It depends on the tool. While I'm not familiar with Maven configuration, the manual should describe what you need to do to have the appropriate environment variables available. – l0b0 Jun 25 '13 at 10:39

Append these lines to the .bash_profile file in your HOME directory, i.d. ~/.bash_profile.

share|improve this answer
thank you anyway for your help – d.v.a Jun 25 '13 at 9:32

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.