Installing alternative java on Ubuntu

Printer-friendly versionPDF version

When installing an alternative java on ubuntu, this is what you need to run approximately (The number 1 denotes your preference for this alternative whereby 1 is the highest and any other greater number is last preferred) :

 

update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_181/bin/java" 1
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_181/bin/javac" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_181/bin/javaws" 1
chmod a+x /usr/bin/java
chmod a+x /usr/bin/javac
chmod a+x /usr/bin/javaws
chown -R root:root /usr/lib/jvm/jdk1.8.0_181
update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javaws
echo export JAVA_HOME="/usr/lib/jvm/jdk1.8.0_181" >> /etc/environment

 

Top level category:

Add new comment