2

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.

2 Answers 2

2

@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".

2
  • 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, 2013 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, 2013 at 10:39
0

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .