I'm trying to install java-13 on Ubuntu 18.04 following this tutorial.
I've installed java-11 before which is preventing these commands taking effect
sudo mv jdk-13 /opt/
sudo tee /etc/profile.d/jdk13.sh <<EOF
export JAVA_HOME=/opt/jdk-13
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
source /etc/profile.d/jdk13.sh
type java
command gives this
java is hashed (/usr/bin/java)
I guess this is due to some setting in some environment variables config file e.g. $HOME/.profile.
How do I know which file is overwriting my /etc/profile.d/jdk13.sh
?
I also tried this command
export PATH=\$JAVA_HOME/bin:\$PATH
and got
java -version
Command 'java' is available in '/usr/bin/java'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
update-alternatives
mechanism - either directly, or viaupdate-java-alternatives
. See for example Is there a way to update all Java related alternatives?