On 23 May 2010 13:55, Henning Bekel <h.bekel / googlemail.com> wrote:
> Michal Suchanek wrote:
>
>> I am trying to run some JRuby script and I have to set the CLASSPATH
>> for my script to work.
> [...]
>> Note that while this example uses JRuby there might be native
>> extensions which require specific environment settings and woud have
>> the same launcher requirements.
>
> To rephrase: Your software requires some environment variables to be set
> in order to run. The standard way of providing this is is to install a
> script with the executable bit set in /etc/profile.d/ that modifies the
> environment variables on login, e.g.:
>
> /etc/profile.d/mypackage.sh:
>
> export CLASSPATH="$CLASSPATH:/additional/class/paths"
>
> /etc/profile is read on login and should run any executable scripts it
> finds in /etc/profile.d/.
>
> Hope this helps,
> Henning

Well, actually it does not.

If I wanted to distribute the script in multiple files then
distributing it with a launcher would be just fine and would not
require the user of the script to have administrative privileges to
install the script in a system directory nor the additional knowledge
how to make it effective without restarting his session.

However, I was aiming for one self-contained example which is easy to
distribute so I wanted one file.

Also I do not want to inflate the environment needlessly while the
script is not in use. It is not a good practice, the environment space
is limited.


Thanks

Michal