Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Update Alternatives for Java

There are a lot of Q&As out there on how to do this... Some good info here:

I usually install my JDK under /usr/lib/jvm alongside the others:

cd /usr/lib/jvm
sudo tar xf ~/Downloads/jdk-8u91-linux-x64.tar.gz
sudo chown -R root:root jdk1.8.0_91
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_91/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_91/bin/javac 1
sudo update-alternatives --install /usr/bin/jexec jexec /usr/lib/jvm/jdk1.8.0_91/lib/jexec 1
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jexec

NOTE: If you're also installing netbeans and hit some problems with the JDK not being found, you can configure it in the netbeans installation directory in etc/netbeans.conf. Search for the jdkhome and point it accordingly, e.g.:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment