HOW TO SWITCH JAVA VERSION and SET JAVA_HOME PATH ON MAC OS M1 M2

preview_player
Показать описание
STEP 1 : Open Terminal. Check java version java -version

STEP 2 : Check java compiler version javac -version

STEP 3 : Run command /usr/libexec/java_home -V This will show the available versions

STEP 4 : Goto folder - /Library/Java/JavaVirtualMachines This should have folders of all Java/JDK available on the system

STEP 5 : Goto the folder of JAVA you want and get the path of its home folder (which has bin folder)

STEP 6 : On terminal run the following commands

echo $JAVA_HOME

echo $JAVA_HOME

To set the path permanently

echo $SHELL

Note: if you are using older mac os, for the command echo $SHELL you may get result like .bash_profile
Then your default profile is bash and the changes you will make will be in file .bash_profile and not .zshrc
So you can replace in the below commands .zshrc with .bash_profile

pwd

open .zshrc

nano .zshrc | vi .zshrc

open .zshrc

Add the following:

Save and close

source .zshrc

STEP 7 : Open a new terminal and check

java -version
javac -version
echo $JAVA_HOME

------------------------------------------

how to change java version on mac m1 m2
how to switch between java versions on mac
how to set JAVA_HOME path on mac m1 m2
how to set java home path in file permanently

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

Really appreciate you also explained the vi/nano command as I'm very new to cmd. Super helpful!

rosehuang
Автор

I can't thank you enough. You have helped me a ton!

havvanyc
Автор

Before I found your video I was struggling tremendously trying to figure out my java issue. I am learning Salesforce development and I was stuck at step 1 trying to get my VS Code connected and operable with Salesforce DX due to incompatible java versions. I had version 22 set as my default and could not figure out how to delete it or switch over to 17. I stopped trying for a month. This was so easy and clear to follow. Thank you!

geralddeloach
Автор

Very useful, really appreciate your hard work and attention to details :)

moreedsubat
Автор

thank you my friend!! very helpful video!!

guillermoramirez
Автор

It's Detailed lecture. Thank you.

kcccham
Автор

THANK YOU SO MUCH
I AM ABLE TO SUCESSFULL DO THAT BY USING THIS VIDEO

vikrambahure
Автор

Hi Raghav,

Thank you for creating all these amazing videos, your content is amazing and is helping me learn test automation. I am learning Python and Selenium using Python by following your playlists. I do have the following two questions for you:


1 – Will you be making some more videos on Selenium using Python, like advanced frameworks or advanced reporting?


2 – Is the following certification worth pursuing, PCAT – Certified Associate Tester with Python? If, Yes can you please recommend a good course for it?


Regards
Svens

svenstito
Автор

Thansk for great explanation. I have a question
Should I remove export from my zshrc?
It was already there and java -version was pointing 21 but I needed 17 and I put path for 17 at the end of zshrc file

xnrjnww
Автор

Hello, can you make a tutorial for automation with Appium and Python along with installation with or without Android Studio. Thank You

adihanrafiga
Автор

Hello Raghav, I'm really sorry as I was not sure where to ask this question but as needed so posted here, is there any plan in near future that you start tutorials on 'Selenium automation using C#' please?
The reason being our company uses C# for automation and it would be great help if you make tutorials on this course please.
Thanks again a lot once again for providing such a valuable knowledge to us.

ashishnaidu
Автор

Thank you for the video. When I try I got zsh: permission denied:
I have all 1.8, 17.0, 22.0 in both versions from Oracle and Homebrew, the path are different for installed from Oracle and Homebrew. I may don't need both versions? I actually try to set up connection with Spark in R-Studio and still have error there. I guess I need 1.8 for the specific SparkR version and I Studio not catching correct PATH. Have headache with it... Any thoughts?

IrinaMax
Автор

Sir I am from Gilgit Baltistan
Sir I want to start selenium automation using java
Will you please make a video of its installation with every new version setup and first test case to visit website..
I need a vedio of selenium setup using java..
Please help me

exploringgilgitbaltistan
Автор

Hi Raghav,

Im having trouuble in step 3. When I run the command /"usr/libexec/java_home -V" my terminal says this "he operation couldn’t be completed. Unable to locate a Java Runtime." What can I do?

Thks for your content, is really useful!

MarioEduradoGonzalezFlores
Автор

Thank you so much. I went through the steps, set the JAVA HOME path permanently. However, once I open new terminal and check the version, its still returning JAVA 8. I have been sitting trying to solve this issue for 2 days now. Anyone please help!

kal
Автор

Hello, when I Entering Echo $JAVA _HOME Nothing Show in the Terminal.

Alkhattab
Автор

thanks sir for reply but here no any new video its 4 or 3 year back sir
i need new one dear
kindly help mostly students avoid automation because selenium setup is complex and no any new video on selenium setup

exploringgilgitbaltistan
Автор

I learned performance testing with loadrunner tool sir and I've 5y career gap dou to govt jobs preparation.now what's the approach to get the job sir ??

RENU_TALKSS
Автор

I am an automation tester with knowledge in Selenium (Java), Cucumber, Appium, and API Testing (Postman and RestAssured). How much salary can I expect with 1.5 years of experience in Chennai and Bangalore?"

NaveenKumar-gbug
Автор

.zshenv:1: command not found: Export
Do you know what is this mean?
I'm getting with error whenever open the new terminal.
Example: Last login: Thu Mar 7 17:34:17 on ttys000
command not found: Export

myt