[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setting in /etc/profile in debian



yong lee wrote:
> I add new entry in /etc/profile.(see below) 
> #add java variable
> JAVA_HOME=/usr/local/jre1.6.0_01
> export JAVA_HOME
> 
> #add JAVA_HOME to the PATH
> PATH="${JAVA_HOME}/bin:${PATH}"
> export PATH

That is a very un-Debian way of doing things because it requires that
a user log out and then log back in again before this type of change
would take effect.  This is not allowed for official Debian packages.
I realize this is a local addition that you are making and the
official policies do not restrict what a local administrator does.
But usually they are good ideas regardless.

> I thought these new entries would be effective after I
> reopen a new terminal window. But it did not.

No.  The /etc/profile is only sourced by the command line shell upon
login.  You would need to log out and log back in again for that to
take effect.

> I have to manually do source /etc/profile to see the new changes
> after I open a new terminal window everytime.  Even a reboot does
> not help. Does anyone have any idea ?

You say that even a reboot does not help and that seems very strange
to me because I am sure that you would log in after that point. :-)
Are you using a shell other than a POSIX compatible one such as csh?

In any case some standard ways of dealing with this are:

* Install in your $HOME directory instead of /usr/local and then add
  these paths to your $HOME/.bashrc file.  This is typical for a
  personal installation.

* Install a script wrapper in /usr/local/bin that sets these
  environment variables and then calls the program.  This way there is
  no need to log out and log back in again and changes take effect
  immediately.

* Use the Debian java-package to convert Sun's upstream binary Java
  distribution into a Debian package and install it.

I recommend using the java-package method.

  apt-cache show java-package

  Description: utility for building Java(TM) 2 related Debian packages
   This package provides the capability to create a debian package from
   a Java(TM) 2 distribution by just running make-jpkg <filename>.
   .
   This program currently works with the following Java(TM) 2 Runtime
   Environments and Development Kits:
   .
    * Sun Microsystems(TM) 1.4 and 1.5 Standard Edition
    * IBM(TM) 1.3, 1.4, and 5.0 Standard Edition
    * Blackdown Java-Linux 1.3 and 1.4 Standard Edition

This will probably be your best solution.

Bob



Reply to: