How to install Java JDK 21 on MacBook, macOS Sonoma

  Рет қаралды 1,819

Slava Bulba

Slava Bulba

8 ай бұрын

===== Step 0 =====
Check if it is already installed and configured, run in terminal
java -version
zsh: command not found: java
or
The operation couldn’t be completed. Unable to locate a Java Runtime.
===== Step 1 =====
Open in a browser www.oracle.com/java/technolog...
Exact latest available Java version number might be different depending on when you are watching this video
Click on macOS tab
download ARM64 DMG Installer if you have Apple M chip
download x64 DMG Installer if you have Intel chip
Run the file you downloaded and follow steps prompted
===== Step 2 =====
Run the command java -version in terminal again to see the output
===== Step 3 =====
Add JAVA_HOME environment variable in your terminal config file
Go to your user folder in terminal
cd ~/
open .
To see hidden files in the Finder hit keys combination: command + shift + .
Create terminal config file (if you don't already have it in your users folder)
touch .zshrc
or
touch .bash_profile - if your terminal uses bash for some reasons instead of zsh
Now we need to take the folder name for our Java installation, for that go to
cd /Library/Java/JavaVirtualMachines/
open .
In my case the folder has name "jdk-21.jdk", copy it and paste it into the line below which you will put in the config
Open .zshrc file in text editor and add into the beginning of the file
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
Save changes in file and close it. You can use "command + s" and "command + q" key combinations.
Restart/close all terminal windows and open again to apply new configuration that you added
===== Step 4 =====
Run the command java -version in terminal again to see the output
===== Step 5 =====
Select installed JDK in your IDE project settings in File - Project Structure - Platform Settings - SDKs

Пікірлер: 2
@amnahojlas2696
@amnahojlas2696 6 ай бұрын
Thank you so much, this was very helpful and saved me a lot of confusion!
@crypto4elik
@crypto4elik 4 ай бұрын
thanks a lot man!!))
How To Access Any Forked GitHub Repositories Data
9:31
Mental Outlaw
Рет қаралды 39 М.
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 12 МЛН
Playwright - How to check if element is present
3:41
Slava Bulba
Рет қаралды 150
Playwright - How to automate a test for paging
18:56
Slava Bulba
Рет қаралды 120
Why you don't really need to use Page Object Pattern in JS
19:14
iPhone, Galaxy или Pixel? 😎
0:16
serg1us
Рет қаралды 1,3 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
0:56
صدام العزي
Рет қаралды 61 МЛН
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 1 МЛН
Сколько реально стоит ПК Величайшего?
0:37