The contents of the /etc/environment
file on my system is a single line like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
I am running Ubuntu 22.10.
Please, check the file on your system. You are possibly missing the double quote ("
) at the end of the line or there might be other missing or extraneous data in your file.
As you see, the contents of your file contain extraneous information. The first part (starting with PATH=
) is the same as mine. However, the rest of the line (starting with JAVA_HOME=
) should be put on a separate line and by removing the duplicate part (JAVA_HOME="
). Your file should be something like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
JAVA_HOME="/lib/jvm/java-11-openjdk-amd64/bin/java"
However, I recommend to check whether the second line is really needed, because JAVA may not be installed on your system. Please, check with the command:
$ file /lib/jvm/java-11-openjdk-amd64/bin/java
/lib/jvm/java-11-openjdk-amd64/bin/java: cannot open `/lib/jvm/java-11-openjdk-amd64/bin/java' (No such file or directory)
If it says (No such file or directory)
as in the example above, you can remove the second line completely and leave only the first line as I gave you on my first example.
You can edit your file with one you are familiar of the below commands:
$ sudo vi /etc/environment
$ gedit admin:///etc/environment
$ gnome-text-editor admin:///etc/environment