setting global variables
paul at xciv.org
Sat Feb 3 12:08:09 GMT 2001
Chris Raven <c.raven at ukonline.co.uk> wrote:
> I am trying to get JAVA 1.1.8 running under
> FreeBSD 3.2 for a servlet named BrowserHawk
> (http://www.browserhawk.com/) which requires it
> (or similar).
My only experience of Apache and servlets was in getting ApacheJServ
(the Apache Java servlets module) working, and it's rather painful.
The configuration is horrid and trying to debug when it doesn't work
is just painful. Anyway...
> these is working). I am finding information
> very hard to come by although, I did find out
> how to set CLASSPATH finally .... but only on a
> per-user basis :o() !
Environment variables are inherited, that is if you set an environment
variable any future child processes should inherit those variables.
You will see that if you 'su' then the root shell will have inherited
all your user environment variables, an 'su -' will only pick up root's
environment though as it simulates a full login.
> My problem is this, I have set the PATH and
> CLASSPATH variables for the usual login user in
> the .profile file. But, I need to have these
> variables work for all users both current and
> future (including Apache and its affiliated
I think what you need to do is make sure that the environment Apache
starts from has these variables set and it should pick them up.
Probably the easiest way of achieving this is to create your own Apache
start-up script, something like..
However this then does rely on you making sure you use this script
to start Apache every time (and not apachectl) otherwise that
environment won't get set and picked up. So..
> Which file should I be editing to set this global
> PATH and CLASSPATH information? Does anyone know?
Have a look at login.conf(5), it looks like you can set global
variables on a per user basis. For apache this is likely going
to be 'nobody', or you might want to create a custom user for
the httpd to run under.
(Aside, on SVR4 systems it looks like you can set variables in
/etc/default/login, but I've not experimented with that..)
More information about the Ukfreebsd