79219690

Date: 2024-11-24 09:00:16
Score: 1
Natty:
Report link

According to the error your mac uses z shell which has file .zshrc for environment variables. Begin by identifying the directory where Java is installed on your Mac. Typically, Java resides in the ‘/Library/Java/JavaVirtualMachines/’ directory. Open terminal and follow these steps -

  1. Open .zshrc in vim editor

    vim ~/.zshrc

  2. Press Insert or i (insert mode) Paste the java path — —

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

  3. Escape and then press :x (To save and exit)

  4. Verify JAVA_HOME environment variable is correctly set up.

    source ~/.zshrc

    echo $JAVA_HOME

  5. Restart terminal for the changes to reflect or better restart your mac.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Sahil Nag