I am running Debian
. I have a jar
file that I need to execute. A wrapper bash
script does a java -jar MyProg.jar
. The jar
also calls some C
code for which LD_LIBRARY_PATH
needs to be set.
I have set LD_LIBRARY_PATH
in the current user's (let's say Sriram)'s bashrc like so:
export LD_LIBRARY_PATH=myLibLocation
.
Everything works as expected when running the above script from the command line. However, when I run the same bash file by double-clicking on it, LD_LIBRARY_PATH
is not set. Here is a sample bash
script I wrote:
#!/bin/bash
echo `whoami`;
echo "PATH = ${LD_LIBRARY_PATH}"
It runs as expected from the command line but not when I run it by double-clicking. The output in that case is:
Sriram
PATH =
This question is exactly the same as this. I have tried to implement all the suggestions there but have not had success.
Update:
What I tried from the answer to the question I linked to:
1. Created a file ~/.xsessionrc
. It did not exist on my system.
2. Set LD_LIBRARY_PATH
in the above script.
Restarted a new shell. Re-ran the above script. No changes were observed.
Any help is most welcome.
echo `whoami`;
instead of justwhoami
?.profile
, not.bashrc
. The problem you're observing is the main reason not to define environment variables in.bashrc
.