Switch Java Version - HHS-Team670/MustangLib GitHub Wiki

How to switch java version

Authors: Armaan, Aditi

Date: 9/12/24

Steps

Install Java

  1. Install java from here https://jdk.java.net/archive/
    • For Mac: download Arm 64 if you are using a M-series chip, otherwise download x64
  2. If your computer is currently on a version of java other than 17 follow the below steps
    • This step does not apply if this is the first time downloading java

Mac:

  1. open terminal
  2. sudo mv downloads/jdk-<version>.jdk /Library/Java/JavaVirtualMachines/jdk-<version>.jdk to move the java into the correct path
  3. https://medium.com/@devkosal/switching-java-jdk-versions-on-macos-80bc868e686a
    • use /usr/libexec/java_home -V to make sure that your java is in the correct place
  4. touch .zshrc
  5. nano .zshrc
  6. add:
Screenshot 2024-10-23 at 5 31 01 PM and change 1.8 to 17.0.x
  1. Save, quit, check with java -version
  • if you get a malware popup go to privacy and settings in your settings and approve the jdk
  • switch to open ~/.zshrc if it doesn't permanently set using open ~/.bash_profile

Windows:

  1. https://www.happycoders.eu/java/how-to-switch-multiple-java-versions-windows/
⚠️ **GitHub.com Fallback** ⚠️