Skip to content

Instantly share code, notes, and snippets.

@rostegg
Last active October 29, 2019 21:02
Show Gist options
  • Select an option

  • Save rostegg/cbf5f908b2f730aea0fc0c49214be30f to your computer and use it in GitHub Desktop.

Select an option

Save rostegg/cbf5f908b2f730aea0fc0c49214be30f to your computer and use it in GitHub Desktop.
Set environment to Java 11 version
#!/bin/bash
# Copy to /usr/bin and don't forget to make the script executable
# Usage: setjv11
sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
JAVA_HOME_LOCAL="/usr/lib/jvm/java-11-openjdk-amd64/"
sudo sed -i '/^JAVA_HOME/d' /etc/environment
echo "JAVA_HOME=${JAVA_HOME_LOCAL}" | sudo tee -a /etc/environment > /dev/null
. /etc/environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment