How to Set up an Environment variable for JAVA in Latest Mac Os

Please use the below commands If you are using the latest versions of macOS.

Problem Statement

We cannot use ~/.bash_profile to export your environment variable since the bash shell is deprecated in the latest version of macOS.

Solution

Run the below command on Terminal and you ready to use JAVA

1.Run /usr/libexec/java_home in your terminal and you will get things like /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home

2.Run in terminal export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
QAAutomationlabs.com

|| Cypress.io Ambassador || https://qaautomationlabs.com/blogs || PMI-ACP® |ITIL® || PRINCE2® || Cypress|| Selenium| WebdriverIO |API Automation QATube®