I've seen similar questions to this but none have really answered the exact question I have.
Are update-alternatives and PATH related, or alternatives to one another? I ask because I'm a complete beginner with Ubuntu and am setting up Java on my machine. Some guides I've followed download and extract it and then enter a location for JAVA_HOME and export it usually in the user's bashrc file, like so:
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/ export JAVA_HOME
However, other guides use the update-alternatives install command, like so:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
I know the latter effectively sets up a symlink to the /usr/bin folder which I think is a quite "clean" way of doing it. How does the export JAVA_HOME way work? And is one preferable to the other?