[Techtalk] Help, I'm stumbling on the PATH

Tim White tim.white at pronto.com.au
Mon Feb 24 13:18:50 EST 2003


Yes you can, provided that you have already set $JAVA_HOME with a 

JAVA_HOME=/usr/where/ever/your/java/is/at

or you can 

PATH=$PATH:/usr/java/bin

This is so your bash shell can find the 'java' executable that you want it to. Anything that you run from a command line must be in the PATH somewhere, your shell will find the first executable of that name in your PATH. eg many applications are in /bin /usr/bin or /usr/local/bin. They are all in your PATH so that you can just type 'ls' or whatever rather than /bin/ls. If you had two or more 'ls' in different directories that are in your PATH, your shell will run the one in the directory that comes first in your PATH.

This is a reason why it is bad to put a . in your path, especially root. Say I put my PATH as 
	PATH=.:$PATH 
The first place that the shell will look for an executable is in the current directory. If a bad user were to make an bad executable that say elevated access to that user, but needed root to run it, if root were to run an ls in the directory that the executable was in the box may be compromised.

Tim White

>Can I just add the java stuff and a PATH statement, say after the USER
>but before the export, like this:
>PATH=$PATH:$JAVA_HOME/bin
>and have that work out all right?  Is that what I'm meant to do?
#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################



More information about the Techtalk mailing list