What is wrong with the PATH in my /etc/environment?

Asked by Frank Steudle

Dear Ubuntu-Community,

I try to add the bin-directory of Java-DB (Derby) to my PATH-variable in /etc/environment. Here is what I have so far:

+-------------------------------------------------------------------------------------------------------------+
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="de_DE.UTF-8"
LANGUAGE="de_DE:de:en_GB:en"

JAVA_HOME="/usr/lib/jvm/java-6-sun"

DERBY_HOME="/usr/lib/jvm/java-6-sun/db"

PATH=${PATH}:${DERBY_HOME}/bin
export PATH

CLASSPATH=".:"

AWT_TOOLKIT="MToolkit"
+-------------------------------------------------------------------------------------------------------------+

I added the the lines "PATH=${PATH}:${DERBY_HOME}/bin" and "export PATH" to /etc/environment. If I try to use sysinfo, which is an executable inside /usr/lib/jvm/java-6-sun/db/bin, within Gnome Terminal it won't be executed. Terminal says: bash: ij: command not found

If I change directory by using cd $DERBY_HOME it changes - like expected - into the directory. The executables mentioned above also start by adding the $DERBY_HOME/bin in front of the filename.

I use Ubuntu 7.10, radeon-driver with 3d-desktop running. Java and Java-db are both installed from universe-repository. Java-executables are working within Terminal (for example "java"), which must be set up by the synaptic installation.

Have you got a guess? Thank you very much in advance!

Sincerely
Frank

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Frank Steudle
Solved:
Last query:
Last reply:
Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1

Please open a terminal and type:

echo $PATH

copy and paste result here

Thank you

Revision history for this message
Frank Steudle (tigerscar-maillisten) said :
#2

Hi marcobra!

Thank you for your fast reply! Here is the mentioned output:

frank@franki64:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

It cuts off quite a bit. The /usr/sbin, /usr/bin/sbin and /sbin directories are missing.

Thanks for your help in advance!

Regards
Frank

Revision history for this message
Robert Di Gioia (digioiar) said :
#3

Hi

Check to make sure that your PATH variable isn't being redefined in one of these files

/etc/profile
/etc/bash.bashrc
~/.bashrc

Revision history for this message
Frank Steudle (tigerscar-maillisten) said :
#4

Hi marcobra!

I checked now /etc/profile, but in my opinion there is no PATH redefined?

+------------------------------------------------------------------------------------------+
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

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

umask 022
+------------------------------------------------------------------------------------------+

Nor it is in /etc/bash.bashrc?
+------------------------------------------------------------------------------------------+
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi

# sudo hint
if [ ! -e $HOME/.sudo_as_admin_successful ]; then
    case " $(groups) " in *\ admin\ *)
    if [ -x /usr/bin/sudo ]; then
 cat <<-EOF
 To run a command as administrator (user "root"), use "sudo <command>".
 See "man sudo_root" for details.

 EOF
    fi
    esac
fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found ]; then
 function command_not_found_handle {
                /usr/bin/python /usr/lib/command-not-found -- $1
                return $?
 }
fi
+------------------------------------------------------------------------------------------+

Sorry for posting these files, but I am not quite sure about it. There is no ~/.bashrc file in my home-directory. I wonder where Ubuntu stores the PATH-Info for Java. It works fine, although my path is broken. I tried to find a file containing the path to java, by running sudo find . -exec grep -H "/usr/lib/jvm/java-6-sun" {} \; - It doesn't work.

Thank you for your help again!

Bye Frank

Revision history for this message
Albert Damen (albrt) said :
#5

Change the line PATH=${PATH}:${DERBY_HOME}/bin into PATH="${PATH}:${DERBY_HOME}/bin" (watch the quotes).

Good luck,
Albert

Revision history for this message
Frank Steudle (tigerscar-maillisten) said :
#6

Dear marcobra, Robert (sorry for mistaken you with marcobra) and Albert,

I made it work by making the following changes in /etc/environment:
+------------------------------------------------------------------------------------------+
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="de_DE.UTF-8"
LANGUAGE="de_DE:de:en_GB:en"

JAVA_HOME="/usr/lib/jvm/java-6-sun"

DERBY_HOME="/usr/lib/jvm/java-6-sun/db"

CLASSPATH=".:"

AWT_TOOLKIT="MToolkit"
+------------------------------------------------------------------------------------------+

I deleted and added the overwriting of the PATH-environment variable to my personal .bashrc:
+------------------------------------------------------------------------------------------+
export PATH=$PATH:$DERBY_HOME/bin
+------------------------------------------------------------------------------------------+

For me there is now a separation of concerns. In /etc/environment is the place to declare the environment variable and in .bashrc is the place to overwrite or to append some pathes.

Thank you very much again. I am very grateful! Go on like this.

Kind regards
Frank