Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I tried to export JAVA, used this

JAVA_HOME=/etc/jdk1.7.0_07/
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 stackoverflow.com Jun 24 '13 at 23:39

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

2 Answers 2

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'
JAVA_HOME=/etc/jdk1.7.0_07/
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
EOF

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

 
discard

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.