1

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

2 Answers 2

0

I admit I don't know anything about NX. I'll give this a shot though.

Was an NX specific user created in your /home directory? Maybe there is a .bashrc that needs to be modified there.

Are there NX configuration files in /etc that might let you provide environment variables?

Have you tried adding in your variables to a file that is applied to all accounts automatically like /etc/bashrc or /etc/bash.bashrc or /etc/profile?

0

I've never used NX but from what I've read it connects using standard ssh. It is possible to set environment variables for the ssh session by putting them in $HOME/.ssh/environment. Try adding your path to that file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .