Installing Java on your system

PUBLISHED Jul 21st, 2018

Last day, I wrote a nice article about the fundamentals of object oriented programming. Now we will be installing Java, or more precisely the Java Development Kit (JDK) on our Windows System, and will write our first java program too.

But before going any further, I recommend you to introduce yourself to the object oriented basics from the last article. Please visit this article here if you haven’t yet.

Downloading JDK

The Java Development Kit (JDK) is consists of necessary tools that are required to build java files. So we need to download and install it. Go to the Java SE download page <a href=”” http: technetwork java javase downloads index.html”“>here</a> and download the latest version of JDK.

Download JDK
Download JDK

It has a simple installation, just agree - next - next, it will also let you download and install JRE (Java Runtime Environment) which is required to run the Java Programs.

While installing, remember the installation directory, where you are installing it.

Adding Path to Java Binaries

Find where you have installed JDK. There will be a folder called bin there. Copy that address. For me, it is C:\Program Files\Java\jdk-10.0.1\bin copy your address.

Now search this in Start Menu: Edit Environment Variables for your account. A setting box will appear, select Path and click Edit.

Environment Variables
Environment Variables

A new window will appear. Click on New, and add the address which you copied. My one looks like this. Your address might be different.

JDK Path
JDK Path

Now click OK to this, and OK to the back window and the changes will be saved now.

Why we did so? The JDK tools are actually command lines tools. So doing the above steps is to make it easy to use Java with command prompt.

Hello Java

Now let’s write our first Java Program.

You can use Notepad but you have to be cautious that the file is saved as .java extension. Use save as, file type as all files, and then add the extension. It would be better to use a good text editor like Notepad++ <a href=”” https:”“>download here</a>.

Java on Notepad
Java on Notepad

Note certain things. For me, I created a directory called c:\work\java, and will use this to test our java codes. The file name is and (H is capital) and in the java program, the class name is also Hello. I will explain these things further. First, let’s test it.

class Hello {
public static void main(String args[]){
	System.out.println("Hello Java!");

So the file is now present as c:\work\java\

Now start the command prompt. Type cmd in start menu.

Now move to your directory using cd command.

Now we need to compile a java program. For that, we use javac utility. This will convert the java source files into class files.

javac <>

If the compilation is successful, it will give no errors, and then you can run the java class files using

java <class-Name>

So doing this actually

Java on Command Prompt
Java on Command Prompt

And we get our output “Hello Java!”

So everything is working fine. This article was all about setting up java. In the next article, we will start understanding the code itself.

Until then, keep learning programming from zero at!

You might also like:


(rand) Basic Formatted Input
(rand) Arrays Some cool examples
(rand) 7 Reasons why you should use GitHub Pages

© Shubham Ramdeo, 2020
you are really awesome!