For Windows:

1. Download the Java Development Kit (JDK) from the official Oracle website (Here I mentioned JDK 17)


2. Run the installer and follow the on-screen instructions.

3. After installation,you can find the JDK path, where it's installed by using commend prompt

where java

4. you may need to set the JAVA_HOME environment variable. You can do this by adding the following line to your system environment variables

JAVA_HOME=C:\Path of JDK 

5. Replace "C:\Path\To\Your\JDK" with the actual path where your JDK is installed.

6. Add the bin directory to the system PATH variable. Edit the PATH variable in system environment variables and append the following to the end of ;

%JAVA_HOME%\bin

7. Open a new command prompt and verify the installation

java -version

For macOS:

1. Open a terminal

2. Install Homebrew if you haven't already
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com
/Homebrew/install/HEAD/install.sh)"

3. Install the AdoptOpenJDK package

brew install --cask adoptopenjdk

4. Open a new command prompt and verify the installation

java -version