2

I have placed Java related info to etc/environment:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games /usr/local/jdk-9.0.1/bin"
JAVA_HOME="/usr/local/jdk-9.0.1"

Then source /etc/environment I expect that it will register JAVA_HOME in exports.

Command export gives a list with updated PATH, but I can't find JAVA_HOME there. Why?

1 Answer 1

2

It's explained by the following: the /etc/environment file is not a shell script and contains only properties that read when the system starts. The source command is used to launch shell scripts in the current console. You can restart your system to apply the changes or add this lines into the ~/.profile or ~/.bashrc files and start the source command for one of them.

Note that properties from the /etc/environment file will be applied to all of the users; the lines from the ~/.profile file only for defined one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .