I just added the paths I wanted to access from Msys2 into the .bash_profile
file in home/{my user name}/
. That works. I just used Notepad++ in Windows to edit, but you can use nano or vim as well.
I couldn't get the "inherit" in the .ini file to work, or the msys2 shell cmd (which opened another terminal window with the same path as what I started out with) to work either.
I didn't really want the whole Windows path anyway, it has the bin folder for Git for Windows (a crippled MingW64 build) and I thought weird stuff might happen.
The file looks looks like this:
# User dependent .bash_profile file
# source the users bashrc if it exists
if [ -f "${HOME}/.bashrc" ] ; then
source "${HOME}/.bashrc"
fi
# Add Coretto Java 11 and Windows Python to path
PATH="${PATH}:/c/batch:/c/Program Files/Python310/Scripts/:/c/Program Files/Python310/:/c/Program Files/Amazon Corretto/jdk11.0.16_9/bin"
Remember to change C:\
to /c/
and all backslashes to forward slashes. Use colons to separate paths, not semicolons. Surround the path with quotes. Use ${PATH}
to keep the existing path to all those /bin/
directories. Spaces in the directory names are fine.
Here is what I get in the Msys2 terminal:
StephanPeters@Stephan-HPZBook15G4-Y4E78AV MSYS ~
# java --version
openjdk 11.0.16.1 2022-08-12 LTS
OpenJDK Runtime Environment Corretto-11.0.16.9.1 (build 11.0.16.1+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.16.9.1 (build 11.0.16.1+9-LTS, mixed mode)
StephanPeters@Stephan-HPZBook15G4-Y4E78AV MSYS ~
# which java
/c/Program Files/Amazon Corretto/jdk11.0.16_9/bin/java
StephanPeters@Stephan-HPZBook15G4-Y4E78AV MSYS ~
#
Path in use: Msys2