Where to set environment variables

Bastian Doetsch bastian.doetsch at gmx.de
Wed Oct 20 13:58:36 UTC 2004


Am Mittwoch, den 20.10.2004, 13:49 +0100 schrieb Jan Kokoska:

> On Wed, 2004-10-20 at 13:30 +0100, Darren Wheatley wrote:
> > Hi,
> > 
> > Can anyone tell me definitively where to put environment settings please?
> > 
> > I have installed the j2sdk from Sun, but need to alter my PATH to point 
> > to it.
> > 
> > I have tried adding the following to ~/.gcprofile, ~/.bash_profile, and 
> > ~/.bashrc but nothing seems to set my path properly:
> > 
> >     export PATH=$PATH:/usr/local/java/bin
> > 
> > I need to be able to set environment variables for both shell users and 
> > server processes. Again, I tried /etc/profile for server environment 
> > variables but that didn't work either.
> 
> /etc/profile typically sets PATH system-wide (to be overriden in
> ~/.bash_profile), so please use that. You should already have the
> variable set there (and exported at the end of file) so just add to it
> your java path. 
> 


Got the same problem here. Following, you can see my /etc/profile:


root at basti:/home/bdoetsch #   more /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

JAVA_HOME="/opt/jdk1.5.0"

PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/X11:/usr/games:$JAVA_HOME:$JAVA_HOME/bin"

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
        . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

export JAVA_HOME
export PATH

umask 022



and here's the result when I type echo $PATH:


bdoetsch at basti:~ $ echo $PATH
/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games


So where's the error?
Thanks,
Bastian



> Jan
> 
> 

-- 

"The path of excess leads to the palace of wisdom."
- William Blake, The marriage of heaven and hell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20041020/feab90c9/attachment.html>


More information about the ubuntu-users mailing list