I was trying to run Maven (mvn) on Windows 10 in an ubuntu shell (WSL2) It complained that it cannot see the JDK.
$ mvn -archetype:generate -DgroupId=com.lynda -Darti
factId=sampleWeb -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
So it got me wondering; there are a number of startup and login scripts. What is the best practice of where to put environment variables in?
.profile or .bashrc .bash_login
and at the beginning of the file, or at the end?
My question is about the best place to source the environment variables. This one is about the general difference between the files. It is not a duplicate of the other question.