bash_profile and the PATH variable - path

I have the following in my bash_profile to automatically run the smlnjinterpreter:
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/smlnj-110.74/bin:${PATH}"
export PATH
Additionally I would also like to run theswi prolog interpreter by adding its path at:
\opt\local\bin
How can I set the PATH variable to check both or is there a better way?
Why does Petite Chez Scheme require no PATH or environment variable settings? That is, when I type petite into the terminal the petite chez scheme interpreter starts automatically.

How can I set the PATH variable to check both?
This is one way, not necessarily the best way
items=(
/Library/Frameworks/Python.framework/Versions/2.7/bin
/usr/local/smlnj-110.74/bin
/opt/local/bin
)
for item in ${items[*]}
do
PATH=${item}:${PATH}
done
export PATH
Why does Petite Chez Scheme require no PATH or environment variable settings?
Perhaps it installs to a standard location, such as
/bin, /usr/bin, /usr/local/bin

Related

WIN: Setting a path to the executable - creating a new Environmental Variable vs. using $PATH

I am currently working on a script that uses an executable to perform certain tasks. In order for the script to find the executable file it needs to know the directory on the Windows where the executable resides. So I decided to store the path to the executable into an Environmental Variable and read out it from the script.
So I have 2 options on how to store the info into the environmetnal variables:
Either create my own Environmental Variable $MY_ENV_VAR and assign the path to the executable to it.
Or add the path to the executable directly to the existing $PATH variable of the Windows OS and let the script search through the paths listed in the $PATH to find the executable.
I would like to get to know what are the pros and cons of both approaches and what is the best pratice.
I guess runtime-wise and script-implementation-wise the 1st solution is a faster and simpler one.
However, the script ought to be used by the different users and I would like to go for a more user intuitive / user friendly solution.

I have deleted my path variable in Environment variable how can I now add MinGw compiler

I have deleted my path variable in Environment variable how can I now add MinGw compiler.How can I now add path for MinGw compiler in my device .Pls Help....
Personally I never add the location of the MinGW compiler to my PATH. The main reason is that I sometimes use different MinGW/MinGW-w64 toolchains on the same system.
You can open a Command Prompt or MSYS2 shell and add the MinGW's bin location to the PATH for just that session.
In Command Prompt that would look like:
SET PATH=C:\MinGW\mingw32\bin
or in MSYS2 shell:
export PATH=/C/MinGW/mingw32/bin:$PATH
Or if you use an IDE you can specify the path there, so that also doesn't require a global PATH environment variable setting. See https://winlibs.com/#usage-codeblocks for an example on how to do this with MinGW-w64 and Code::Blocks.

Need Help understanding how PATH works with Windows 7

I am trying to add to the PATH via the Environment Variable settings windows for python.exe.
I have read the instructions using SetX from the March 3, 2012 discussion about this issue and am worried I will make a mess of my machine, so want to stick with the GUI process.
The directory path is C:\Users\Paul\AppData\Local\Programs\Python\Python37\python.exe.
That is a copy from the addition I made in the System Variables section of the Environment Variables window.
I have labelled the Variable Name as "Python", no quotation marks.
I have checked the path, and it looks good to me, and have rebooted the computer. But I still get the
'python.exe' is not recognized as an internal or external command, operable program or batch file.' error in every directory expect if I am specifically in the Python37 directory.
Any idea what I am doing wrong?
The path environment variable contains one or more paths, separated by semicolons. When you try to execute a command in cmd.exe it checks each path listed in the path variable in order of first to last until it finds the executable or runs out of paths to check.
You can experiment without making permanent changes to your system first. Run cmd.exe and type
set path=%path%;C:\Users\Paul\AppData\Local\Programs\Python\Python37
Running python.exe should now work in any directory in this cmd.exe window.
Unlike other environment variables, path is special and is a merged value from the system and user variables. Since you installed python just for yourself you might as well just use a user variable.
In the system properties where you edit environment variables, if there is no path user variable, create one and set it to C:\Users\Paul\AppData\Local\Programs\Python\Python37 or if it already exists, append ;C:\Users\Paul\AppData\Local\Programs\Python\Python37.
In newer versions of Windows 10 the UI is different and you don't have to add the semicolon because it lets you edit them as separate entries.

Not able to set ENV LUA_PATH No such file or directory

I am working on open source LUA project. It has some modules and submodules. I am trying to set LUA_PATH env. But it always fails with error.
bash: ./user_modules/shared_testcases/?.lua: No such file or directory
Command I used is:
set LUA_PATH /usr/local/share/lua/5.2/?.lua;./user_modules/shared_testcases/?.lua
You need to quote the path:
set LUA_PATH '/usr/local/share/lua/5.2/?.lua;./user_modules/shared_testcases/?.lua'
Otherwise, as you have seen, the shell tries to expand the ?
in the path.

Javac is not being recognized even after setting the class path variable

My problem is that I have set the bin path in Class path variables. After that
Command Prompt is recognizing "java" command but "javac" program is still not being recognized.
Make sure you are pointing to the "bin" directory of the jdk and NOT jre. Also, as Juned answered, you need to open a new command line after you update the environment variable in "PATH"
Assuming you have set the jdk/bin folder path to your system PATH variable.
Just make sure you re-open the command line because an open command line does refresh itself with the new environment params.
After adding jdk/bin to your PATH, simply launch a new command prompt and type javac, java magic should start happening.
Adding C:\Program Files\Java\jdk1.8.0_121\bin to Path environmental variable should be done. But you shouldn't insert any space between the previous ; and the path of bin folder:
Path: c:\some name\.....\; C:\Program Files\Java\jdk1.8.0_121\bin ==>WRONG
Path: c:\some name\.....\;C:\Program Files\Java\jdk1.8.0_121\bin ==>OK

Resources