Setting Up Java Development Environment

In this tutorial, we will go through the steps to prepare your local machine for Java development.

1. Install Java Development Kit (JDK)

  1. Go to this page on the Oracle website → Java SE Downloads,
  2. Click on JDK Download. At the top of the page, you have the latest version of the JDK, if you scroll down you will see the older versions, choose whichever version suits you best,
  3. Choose Windows x64 Installer (.exe) for Windows or macOS Installer for MAC OS,
  4. When the download is complete, find the JDK .exe program in your Downloads folder and run it. Installation is very simple, just follow the instructions and it should be very easy to install. 

    Remember where you installed Java. On Windows, it is usually, it is at C:\Program Files\Java


2.1. Setting up path for Windows 10

Assuming that you have installed Java in C:\Program files\Java\JDK directory.

2.2. Set JAVA_HOME environment variable

Open Advanced System Settings.

  1. In Windows Search Box, type in advanced system settings
  2. It should appear in the Best match. Click on it.
advanced system settings windows10

    3. Click on Environment Variables,
    4. Under System variables click the New button and enter JAVA_HOME as the Variable name and the path to your Java JDK directory under Variable value.

set java_home variable

2.3. Update System PATH

  1. In the Environment Variables window under System variables, select Path variable,
  2. Click on Edit,
  3.  In the Edit environment variable window, click New,
  4. Type in %JAVA_HOME%\bin
  5. Click OK
java update system path variable

Trying if Java Works

Open a command prompt, and type the following command. 

java -version 

You can also try executing the following command: 

javac -version

You should see the following output.

javac version java version

3. Setting up Path on MAC OS

To learn how to configure JAVA_HOME on a Mac computer, read How to Set JAVA_HOME on Mac

Leave a Reply

Your email address will not be published.