How to Install Java JDK on Mac OS and set JAVA HOME variable

preview_player
Показать описание

How to Install Java JDK on Mac OS and set JAVA_HOME variable

Step 1 - Check if Java is already installed java -version

Step 3 - Install JDK with Homebrew brew install openjdk

Step 4 - Verify installation java -version

Step 5 - Set Java Home

Homebrew will usually set the JAVA_HOME environment variable correctly
However, if it's not set or you need to set it manually.
Can do so by adding the following line to your shell profile file
(.bash_profile, .zshrc, or similar):

export JAVA_HOME="/usr/local/opt/openjdk"

To apply this change, run:

source ~/.bash_profile # or ~/.zshrc if you're using Zsh

On Mac OS X 10.5 or later, we can use /usr/libexec/java_home to return the location of the default JDK.

Raghav Pal

▬▬▬▬▬▬▬

Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can

If my work has helped you, consider helping any animal near you, in any way you can

Never Stop Learning
Raghav Pal

▬▬▬▬ USEFUL LINKS ▬▬▬▬

▬▬ CI | CD | DEVOPS ▬▬

▬▬ UI TESTING ▬▬

▬▬ API TESTING ▬▬

▬▬ MOBILE TESTING ▬▬

▬▬ PERFORMANCE TESTING ▬▬

▬▬ SOURCE CODE MANAGEMENT ▬▬

▬▬ IDE ▬▬

▬▬ PROGRAMMING ▬▬

▬▬ BUILD TOOLS ▬▬

▬▬ CLOUD SERVICES ▬▬

▬▬ DATA FORMATS ▬▬

▬▬ OTHERS ▬▬


Рекомендации по теме
Комментарии
Автор

Your tutorials are very clear and useful. I have been trying to start an Appium test in Eclipse IDE and have completed the necessary setup. However, the io.appium dependencies are not getting downloaded, and I am encountering compilation errors. I have tried redoing all the steps and debugging as much as I could, but the issue persists. Could you please suggest any solutions?

kavithag
Автор

Thank you so much, sir. I was trying for hours to install java on my mac. Your tutorial were helpful really. Have a nice day:D

rajikuui
Автор

Thanks man, I've been trying to install it to learn how to code, your video helped me a lot!

raduionascu
Автор

Thank you Sir, this helped me a lot, I've been struggling back to back to switch from Java 21 to Java 11

puseletsomaraba
Автор

Thank you so so so much, I am so glad I found this tutorial :)

frezamajithia
Автор

Hi Raghav, your doing great work for testing community, Thank you for all the effort, had a question I had selenium python scripts for the application I am working, but now they are moving the UI to Angular JS technology, so selenium python is not helpful for me now, can you suggest a good tool to use for the new UI, Thanks in advance

sabataranum
Автор

Hi,
When running export
And after that if run ~/.zshrc or ~/.bash_profile

It says no such file or directory

harshrana
Автор

when I tried to open home-brew, terminal gave me a list of commands, but won't accept "brew" as part of the command
help?

theecrownedcrow
Автор

hi raghav till final step got everything but not able to get to return the location of the default JDK in Mac what to do i getting the same error as you shown.

Nandhakumar-ku
Автор

hi sir i have installed java home according to your method but i m not understanding how to open it

DhyanN-lhrm
Автор

The last bit of setting java home doesn't work

decentwig
Автор

When it asks for a password which password is it?

kingggslayerr
Автор

Hi raghav Plz tell me appium studio is not download in my laptop .
Laptop features -
Processor - i3
O.S.- windows 11
Ram - 8GB
SDD - 500 GB.
Why not install ?

Amitpatil-gg