Download and Install JDK (Java Development Kit) on Windows, Mac

Mausam Singh
3 min readSep 12, 2022

Java Runtime Environment or Java Development Kit 🤔?

The JRE (Java Runtime Environment) is needed for running Java and Kotlin programs. The JDK (Java Development Kit) includes the JRE + the development tools you’ll need for writing and running Java programs. You will need the JDK for writing Kotlin Programs.

JDK=JRE+Development Tools

Steps to download the JDK

  1. It recommended that you install only the latest LTS(Long term support) JDK. If you have any older version of JDK then uninstall it.

2. Now, download the JDK

For mac — DMG Installer of Java SE Development Kit
  • Click the Download button under the JDK for the latest LTS Java SE version.
  • Check Accept License Agreement.
  • Choose the JDK for your operating system(Linux/macOS/Windows)

After downloading JDK, now you need to install it.

Install the JDK for macOS

From either the Downloads window of the browser, or from the file browser, double-click the .dmg file to launch the install file.
1. A Finder window appears with an icon of an open box and the name of the .pkg file.
2. Double-click the package icon to launch the Install app, and follow the prompts as they appear.
3. You might need to enter the administrator password to continue and after that installation will be completed in sometime.

Do the below steps for first time macOS user.

1 . $ /usr/libexec/java_home -v{YOUR_VERSION}
2 . $ code ~/. bash_profile // find bash_profile and copy the

Now find the bash_profile and copy the text from it.

3. $ export JAVA_HOME=/Library/Java/JavaVirtualMachines  /jdk-{YOUR_VERSION}.jdk/Contents/Home
4. $ source ~/.bash_profile

After that, you can check the java version

$ java -version
$ javac -version

If you are able to see the version then it is successfully downloaded and installed in macOS

Install the JDK for Windows

Run the downloaded installer .exe which installs both the JDK and the JRE.
1. By default, the JDK and JRE will be installed in the below directory

C:\Program Files\Java\…x     // where x denotes the version numberC:\Program Files\Java\...x   // where x denotes the version number

Accept by defaults, and follow the simple screen instructions to install the JDK. Just like macOS user, for windows user -

Add the JDK installation path to PATH

  1. Open Control Panel -> System -> Advanced system settings -> Environment Variables.
  2. Under System variables, scroll down to select Path and click Edit
  3. Append to the existing Path value a semi-colon “;” then JDK’s bin directory
C:\Program Files\Java\jdk-x\bin

Keep moving and improving. That’s the only way to success. #HappyLearning

Feel free to comments. That’s also why I write. So that there is an exchange. And don’t hesitate to follow me :)

--

--

Mausam Singh

Aspiring Product Manager | Android Developer | Ex-SDE at Meesho | I believe in writing for self reflection and reading for self development.