Skip to content

Instantly share code, notes, and snippets.

@chiangbing
Last active December 28, 2015 15:59
Show Gist options
  • Save chiangbing/7525918 to your computer and use it in GitHub Desktop.
Save chiangbing/7525918 to your computer and use it in GitHub Desktop.
Execute after jdk is installed so that it become the default java version.
JDK_VERSION=1.7.0_45
sudo alternatives --install /usr/bin/java java /usr/java/jdk${JDK_VERSION}/jre/bin/java 200000
sudo alternatives --install /usr/bin/javaws javaws /usr/java/jdk${JDK_VERSION}/jre/bin/javaws 200000
sudo alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk${JDK_VERSION}/jre/lib/i386/libnpjp2.so 200000
sudo alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk${JDK_VERSION}/jre/lib/amd64/libnpjp2.so 200000
sudo alternatives --install /usr/bin/javac javac /usr/java/jdk${JDK_VERSION}/bin/javac 200000
sudo alternatives --install /usr/bin/jar jar /usr/java/jdk${JDK_VERSION}/bin/jar 200000
sudo alternatives --install /usr/lib/jvm/java-1.7.0 java_sdk_1.7.0 /usr/java/jdk${JDK_VERSION} 200000
sudo alternatives --install /usr/lib/jvm/jre-1.7.0 jre_1.7.0 /usr/java/jdk${JDK_VERSION}/jre 200000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment