2

We have to manually set PATH environment variable for prog applications,I have often heard programmers regardless of their level setting them.

I have been learning C and Java and I remember having done this twice.I read why Environment variables are needed but there it was written that most programs like Media players, File Managers automatically set the environment variables they need.

Why isn't it done similarly for programming applications?

Coderankur
  • 21
  • 3

1 Answers1

0

Why do we need to modify $PATH

When we have something installed for us it will usually be added to $PATH by either:

  • Being installed somewhere already on $PATH
  • Having its location added to $PATH

When we compile our own stuff, or use a copy of a program from a directory not in path we need to add its location to $PATH manually.

The reason it applies a lot to programming tools is that most normal tools are installed in a way that manages $PATH for the user, whereas some programming tools have their executables in different places, or are compiled by the user, requiring $PATH modification.

Why do we need to set $JAVA_HOME

It is quite possible to have multiple JRE/JDKs installed at once (different versions, oracle/OpenJDK), and this variable says which one to use, it is not used for finding java tools at the terminal though, that is the role of $PATH

More Info

jrtapsell
  • 6,719
  • 1
  • 26
  • 49