How to Install Java JDK on MacOS with JAVA_HOME Step by Step installation
Download Java SDK on Mac
Open Terminal -) java -version
Serach for oracle java sdk
open the first link
choose JDK download
select macOS installer
Download the JDK .dmg file here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Install the SDK for Mac
- Double click the .dmg file.
- Double click the package icon to launch the Install app.
- Click Continue.
- Click Install.
- Enter the administrator user name and password and click Install Software.
- After the software is installed, delete the .dmg file so that you can save disk space.
If The .zshrc file is not present by default in macOS Catalina, So you may need to create it. Additionally you can also use ~/. bash_profile or ~/.profile if they are present to store your java variable
Steps for creation:
- Open Terminal
- Type touch ~/.zshrc to create the respective file. (touch command will create the .zshrc in your current directory but it will be hidden)
- Hit Return
To view/open ~/.zshrc you can do either of two things:
- Open Finder -) Press Cmd+Shift+.
Or:
- I will use Open Terminal -) and type: open ~/.zshrc
- If using bash_profile use: open ~/. bash_profile
- If using .profile use: open ~/.profile
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home"
source ~/.zshrc
Comments
Post a Comment