How to access shell environment variables in Perl script

Question: I would like to access several environment variables in my Perl script. How can I access shell variables from a Perl program? In some cases you may want to access shell environment variables (e.g., $PATH, $PWD, $HOME, $LANG) in your Perl script. While you can pass any needed environment variables to your Perl script […]
Continue reading…

 

How to change sys.path or PYTHONPATH in Python

Question: When I run a Python application, it is not able to find one of imported modules and fails. Looks like the directory of the Python module is not included in the default sys.path used by the Python interpreter. How can I change the default sys.path in Python? When the Python interpreter executes a program […]
Continue reading…

 

How to set JAVA_HOME environment variable automatically on Linux

Question: I need to compile a Java program on my Linux box. For that I already installed JDK (Java Development Kit), and now I’m trying to set JAVA_HOME environment variable to point to the installed JDK. What is the recommended way to set JAVA_HOME environment variable on Linux? Many Java programs or Java-based IDE environments […]
Continue reading…

 

How to change PATH environment variable on Linux

Question: When I try to run an executable, it complains “command not found.” The executable is actually located in /usr/local/bin. How can I add /usr/local/bin to my PATH variable, so that I can run the command without specify the path? In Linux, PATH environment variable stores a set of directories to search for an executable […]
Continue reading…