[lug] modifying environment variables on the fly

rm at mamma.varadinet.de rm at mamma.varadinet.de
Tue Apr 17 09:16:27 MDT 2001


On Tue, Apr 17, 2001 at 11:07:48AM -0400, Hugh Brown wrote:
> I am supporting a bunch of java developers that are working on several
> projects and have to change CLASSPATH each time they switch to a different
> project.  Is there a slick way to do this without doing export
> CLASSPATH="blah:blah:blah...." before they begin working on a new project?

How would you want this to happen? To be effective in all programs
executed you need to change this in the invoking shell. Since called
programs _can't_ modify the environment of the caller you need to
tell the calling shell about the changes in the environment (which
is done either by calling 'export ...' or sourcing a file with the
'.' command. When i did Java i had a set of files in my home directory
that contained the neccessary calls to 'export ...'. Whenever i switched
settings i would issue ' . ~/jdk1.3-env ' and everything worked ok).
Another solution might be to write your own custom wrapper arround
java/javac/javap etc. that sets CLASSPATH and friends accoding to
custom settings (for example by sourcing a .jenv file in the current
directory).

 Ralf

 (Interested in better solutions)

> Hugh
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list