Ubuntu Launcher Items Don't Have Correct Environment Vars under NX
- by ivarley
I've got an environment variable issue I'm having trouble resolving. I'm running Ubuntu (Karmic, 9.10) and coming in via NX (NoMachine) on a Mac.
I've added several environment variables in my .bashrc file, e.g.:
export JAVA_HOME=$HOME/dev/tools/Linux/jdk/jdk1.6.0_16/
Sitting at the machine, this environment variable is available on the command line, as well as for apps I launch from the Main Menu. Coming in over NX, however, the environment variable shows up correctly on the command line, but NOT when I launch things via the launcher.
As an example, I created a simple shell script called testpath in my home folder:
#!/bin/sh
echo $PATH && sleep 5
quit
I gave it execute privileges:
chmod +x testpath
And then I created a launcher item in my Main Menu that simply runs:
./testpath
When I'm sitting at the computer, this launcher runs and shows all the stuff I put into the $PATH variable in my .bashrc file (e.g. $JAVA_HOME, etc). But when I come in over NX, it shows a totally different value for the $PATH variable, despite the fact that if I launch a terminal window (still in NX), and type export $PATH, it shows up correctly.
I assume this has to do with which files are getting loaded by the windowing system over NX, and that it's some other file. But I have no idea how to fix it.
For the record, I also have a .profile file with the following in it:
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi