How to start programming with Java?

Setup Java JDK on Windows and MacOS

To start coding with java, the very first thing you have to do is installing either Java SDK or Java JDK.


There are some differences between these Development Kit of Java.

What is the SDK?

An SDK includes one or many API , programming tools, documentation and some useful things that allow you create the applications for the platforms through another programming languages such as C, C#, Objective-C, etc.

Some popular SDKs:

  • Android SDK: development kit for developing the application on the Android platform.
  • Windows SDK: development kit for developing the application on the Windows platform.

So what about JDK?

JDK or Java SDK is an extension of SDK, in other word, this is an SDK for Java. It includes the useful tools to create the applications, applets and components which is coded by Java programming languages only and run on Java platform such as:

  • appletViewer : run and debug Java applet without browsers.
  • javac : Java compiler.
  • java : java interpreter which call to JRE for accessing and running compiled code via calling main() method.
  • javadoc: showing documents automatically.
  • jdb: a debugger of Java.
  • And many others.

Downloading Java Development Kit

Depending on what you want to build, you can choose whether SDK or JDK. If you are beginning with Java, so it does not matter JDK or SDK. Click here for downloading.

Installing the Java Development Kit

After downloading, if you are using Windows, there would be a “.exe” file in your download folder. In the case of MacOS, it would be a “.dmg” file. There are not much things handful to do, following the instructions and waiting until the installing process done automatically.

If you are using Windows, you need to do one more thing after finished installing, that is setting system variable to let the system knows where to call Java.
Open CMD (Command Prompt window), type:

java -version 

The above command displays which version of Java that you are using. Then, type the following command

set path=%path%;C:\Program Files\Java\you_have_to_replace_by_your_jdk_folder_version\bin

Creating a Java program

After installing all the things, now you need to make sure if it works correctly. For doing it, you can code a simple program like the code below:

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

You can code it by any text editors that you have (eg: notepad, notepad++, sublime Text, etc. ) and save it as “” in wherever you want.

Run a Java code file

Opening Command Prompt if you are in Windows (dirty black and white text window :-)). If you are using Mac, then open Terminal.

Move to the folder where you saved your “” that you created by typing

cd folderName

Then, using dir command (use ls if you are using Mac) to see if your in there. For example


If everything is ok, you need to compile your java file first, typing the following command:


Now is the time to see magical, run the following command:

java fileName

After running that command, you should see “Hello dude!” on your command line window.

Finally, you are at a good starting point with Java. Hoping that this blog helpful for you. If you have any question, please leave your comment, I will answer by my best.

Thanks for reading and see you next blog.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at

Up ↑

%d bloggers like this: