A few questions about Deb

Eric Richardson eric@milagrosoft.com
Thu, 21 Dec 2000 10:04:31 -0700


Icegryphon wrote:
> 
> First question. I've installed Java SDK and the JRE. How do you add directory
> to be use (i.e. kinda like a "path" statement in windows) to be search for the
> binaries. What do I edit to add those directories that I want. So I can use
> them in any directory.
> 
Hi Matt,

I have SuSE, but typically there is a file /etc/profile that the shell
uses to setup the environment. This is the global file for all users.
Here is the portion from SuSE that's applicable. Similar on other
platforms as well.

#
# make path more comfortable
#
MACHINE=`test -x /bin/uname && /bin/uname --machine`
PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin
for DIR in ~/bin/$MACHINE ~/bin ; do
    test -d $DIR && PATH=$DIR:$PATH
done
#test "$UID" = 0 && PATH=/sbin:/usr/sbin:$PATH
test "$UID" = 0 && PATH=/sbin:/usr/sbin:/usr/local/sbin/:$PATH
for DIR in /usr/lib/java/bin \
           /var/lib/dosemu \
           /usr/games/bin \
           /usr/games \
           /opt/bin \
           /opt/gnome/bin \
           /opt/kde/bin \
           /usr/openwin/bin ; do
    test -d $DIR && PATH=$PATH:$DIR
done
test "$UID" = 0 || PATH="$PATH:."
export PATH

Usually the above file calls the personal file $HOME.profile which may
call the $HOME/.bashrc file. I typically put additions to PATH and
aliases and other things in my $HOME/.bashrc but you could also put
customizations in $HOME/.profile as well. I forget the exact cases when
they get called for shells/desktop etc.

In your .bashrc you could put

JAVA_HOME=/path to java
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME

to use java classes you may need to add the following.
export
CLASSPATH=$CLASSPATH:/path/to/myapp.jar:/path/to/directory-with-classes:.

I added current working directory or . to the classpath as well in the
example as well because most ofthe time that is helpful.

Hope this helps,
Eric