This article will help to setup Java development environment on Windows or Ubuntu operating system.

For compiling and executing Java program on your system, you will need a package known as JDK. It stands for Java Development Kit. You can download it here.

You will find out two types of Java packages, JDK and JRE.

JRE stands for Java Runtime Environment. It is used for running the Java program on the system but you will not be able to compile and debug any program on your system using this package as it does not contain compiler and debugger file in it.

JDK package has compiler and debugger files that are used to compile and debug Java programs on your system and also includes JRE.

1) Installing and setting up Java environment on Windows operating system.

It will be better if you have the latest version of java. If you already have any old version of JDK installed on your system then uninstall it.

Following are the steps you should follow.

Step 1: Download JDK from here. Click on Java download link and accept the license agreement. Choose your JDK package for Windows OS.

Step 2: Run the downloaded installer named as jdk-9.0.x_windows-x64_bin.exe (Here x will be your version number). It will install both JDK and JRE.

Step 3: After installation, you need to setup bin directory path in an environment variable. For this just copy the full path of bin directory inside JDK installation directory. Path for bin directory look like this one -> C:\Program Files\Java\jdk<version>\bin .

Step 4:  Launch “Control Panel” ⇒ (Optional) System and Security ⇒ System ⇒ Click “Advanced system settings” in the left pane.

Step 5: Switch to “Advanced” tab ⇒ Click “Environment Variables” button. Under “System Variables” (the bottom pane), scroll down to select “Path” ⇒ Click “Edit…”.

Step 6: It will open a new window. Here click on New button and just paste your path for bin directory and click OK OK OK. And hence you are done.

To check your JDK installation. Open CMD using Windows+R and type cmd.

After opening cmd type java -version

If output of this command is as follows then Congratulations you have successfully installed JDK on your windows machine

prompt> java -version 
Java version "9.0.1" Java(TM) SE Runtime Environment (build 9.0.1+11) 
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

After this step, you are good to go for developing Java programs.

Also read: Overview of Java programming language (Learn Java)

2) Installing and setting up Java environment on Ubuntu operating system.

Step 1: Open a terminal and add PPA using following command.

You need sudo access to this.

Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK8 / JDK9).

There are no actual Java files in this PPA. Ubuntu 16.10 Yakkety Yak is no longer supported by Canonical (and thus, Launchpad and this PPA). The PPA supports Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04.

sudo add-apt-repository ppa:webupd8team/java

Step 2: Update package repository using the following command.

sudo apt-get update

Step 3: Download and Install the installer script.

sudo apt install oracle-java9-installer

Step 4: Set Oracle JDK9 as default, to set oracle jdk9 as default, install the “oracle-java9-set-default” package. This will automatically set the JAVA env variable.

sudo apt install oracle-java9-set-default

Step 5: This will complete your installation, you can check your java version by running following command.

javac -version

Stay connected with us. Thank you 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *