Java Setup

The Java development kit JDK lets the programmer to write and run code in Java language. It is a high level programming language. The latest version of Java is available at Oracle. Programmer can download it from there. Its latest version is Java SE 16. Programmer can also install the previous versions of java as well. All versions of Java are available for free download.

Once the programmed has downloaded and installed the JDK, the programmer can write and run codes in this language on the computer. The sections below describe the detailed steps to download and install the JDK.

Check Java version

The first step is to check whether JDK is installed in your computer or not. Some personal computers come with java already installed. To check if JDK or JSE is already installed in the computer or not, open command prompt. (TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)

java
Command Prompt

And type this command in your command prompt: C:\Users\UserName> -version

Press Enter. The command prompt will show you the version of java installed in your computer if it is already installed. The command prompt will show you something like this depending on the version of your JDK or JSE.

If JDK is not installed then command prompt will show you this error message. version “11.0.1” 2018-10-16 LTS

Install Java

If JDK is not installed, the programmer needs to install it by following the simple steps described ahead. To install JDK or JSE follow the below steps:

  • Go to the Oracle website.
  • Accept the license and agreement
  • And download the JSE file according to your operating system. The options are available for MAC, 32 bit or 64 bit Windows, Linux etc.
  • After the file is downloaded, run the .exe file to install java.
  • After it is successfully installed, user needs to set environment variables needed for JDK or JSE. The below section shows how to set environment variables. This is not recognized as an internal or external command, operable program or batch file.

Set Environment Variables

After the successful installation of JDK or JSE, user needs to set the environment variables in Java. There are two environment variables. These are Path and Classpath.

Path: The path variable assigns the location for executable files like javac, java, etc.

Classpath: The classpath variable assigns location to the library files.

The below section describes how to set environment variables in different operating systems.

For Windows

After installing JDK in C/Program files, perform the following steps to set the environment variables in Windows:

  • Go to Control Panel > System and Security > System > Advanced System Settings and open “System Properties”.
  • Open the “Advanced” tab and click on the “Environment variables” button.
  • Now select the “Path” variable present in System variables and click on the “Edit” button.
  • Then click on the “New” button and add path. Path should be where the JDK is installed, followed by \bin. Or you can go to the JDK file folder and open it, go to its bin folder and copy its path from the properties. Then paste this path in the Path variable.
  • Now click OK and save the settings.

JDK or JSE has been successfully installed in your computer. You can check its version to verify its successful installation.

For LINUX, UNIX, Solaris

To set path variables in LINUX, the path of environment variable should be same as that of JDK binaries. The shell documentation provides detailed procedure for setting path variables in LINUX, UNIX, Solaris.

Java Editor

To write code, programmer needs a Java editor. There are multiple editors and IDEs available online to download for free where programmer can write and save code. You can also download some or use the built in editors in your windows computer. For example, below is the list of most used editors:

  • Notepad: The notepad present in windows can be used as an editor. It is a simple text editor that is pre installed.
  • Textpad: You can also use TextPad that is also a text editor. It is simple to use is available to free download.
  • Eclipse: It is most widely used editor as it is an open source IDE and can be downloaded for free from this link https://www.eclipse.org/. It is easy to install and run.
  • Netbeans: It is also an open source IDE that can be downloaded for free from the link https://www.netbeans.org/index.html.