2

I have a problem with $PATH export. The only place I found where I modify $PATH is /etc/environment:

ANDROID_HOME="/opt/ADT/adt-bundle-linux-x86_64-20130522/sdk"
PROJECT_HOME="/home/tomaszchabinka/Dokumenty/tempFile/android_stb"
PATH="/opt/gradle-1.10/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

But when I type in terminal echo $PATH it returns:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/jdk1.7.0/bin

I don't have /usr/lib/jvm/jdk1.7.0/bin directory so I don't understand why my $PATH export doesn't works and where does /usr/lib/jvm/jdk1.7.0/bin come from.

Also $ANDROID_HOME and $PROJECT_HOME exports correctly; only $PATH export doesn't work.

Can anyone help me?

Richard
  • 8,588
pstrag
  • 121

2 Answers2

3

There are a few places where you can define $PATH:

  • /etc/environment is a plain text file (not a script) that affects all users
  • ~/.pam_environment - the same thing but user-specific

bash also executes some scripts which can be used for modifying $PATH:

  • ~/.profile is executed for a login shell sessions (don't ask me what it means :)
  • ~/.bashrc is executed for non login interactive shell sessions
  • /etc/profile and /etc/bash.bashrc are system wide alternatives for ~/.profile and ~/.bashrc

I read somewhere that /etc/environment is a recommended place for defining your $PATH. So I usually use it. But your path is probably modified in one of the other places.

BTW, when you execute a command with sudo, I think it normally uses root user's $PATH (and not the $PATH of your unprivileged user account). So, ~/.pam_environment, ~/.profile and ~/.bashrc in /root directory may also play a role.

Alexey
  • 188
-2

Put this in ~/.bashrc:

PATH="${PATH}:/opt/gradle-1.10/bin"