Persiapan Pemrograman Java di Linux
80 / 100

What is JDK?

Java Programming Preparation on Linux, JDK stands for Java Development Kit. JDK provides compiler, library, API, and other tools.

If it's your first time hearing these terms, do not worry. Later, you will understand yourself after learning Java.

The main thing is, The JDK provides everything we need to build applications in the Java language.

Java JDK

Nah, on this tutorial.. We will use JDK 8.

Why use this version?

This version is quite stable compared to others. The current version of the JDK—as of this writing—has reached version 15.

Wow, you're far behind.

Do not worry, if you already understand the basics of Java programming. If you want to use any version of the JDK, it will work.

Oracle JDK vs OpenJDK

O ya, need to know as well:

that JDK, some are made by Oracle and there are also versions open source, i.e. OpenJDK.

What is the difference?

The two are equally JDK what differentiates is the license that applies to it. If you are using JDK from Oracle, then you must comply with the license Oracle agreed to with you.

But, if you are using OpenJDK.. you don't have to worry about license problems. Because of that OpenJDK open source with the GNU GPL license.

other than that, OpenJDK is also used for Android Studio and IntelliJ.

How to Install JDK on Linux

Installing JDK on Linux is very easy, simply by typing the following command:

sudo apt install openjdk-8-jdk

and wait until the process is complete.

Instal OpenJDK 8

Then the JDK will be installed on our computer.

To make sure it is installed correctly, try typing command:

java -version

This command is to check the installed Java version.

If it comes out like this:

Versi JDK

This means that the JDK is installed correctly.

Apart from JDK 8, you can also install other versions. Just change the numbers 8 with the desired version.

For example:

sudo apt install openjdk-11-jdk

Then this command will install the JDK version 11.

Hello World Program Creation Experiment

Actually we can start coding Java just by installing JDK only.

We can use a text editor to write program code, then do compile manually.

Let's try..

Open the text editor, can use Gedit, Geany, or Kate.

It's up to you which one to use.. the important thing later we have to save the file with the extension .java.

Write the following program code:

public class HelloWorld {

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


If it's finished..

kode program hello world Java

..Please save with the name

nama file

The file name must be yes, if you use a different name.. later the program won't compile. This is already a rule in java, file name must follow class name.

I suggest keeping it in an easily accessible place, like home folder.

Well next we will compile this program with the command javac.

Please open Terminal, then go to the folder where we saved the program earlier and type the command:


If no error occurs..

compile program compile succeed.

Process compile this will generate a new file i.e HelloWorld.class. This file is bytecode which will run on the JVM.

java file class

Then, to run the program.. we can use this command:

java HelloWorld

Take note, HelloWorld is the class name of the program. This will also be the name of the program.

Don't write like this:

java HelloWorld.class

If the program runs successfully, then the text will appear Hello World.

program hello world java

Program executed successfully.


Easy isn't it?

Nah, in the future we will not do this again. Because it's quite troublesome, every time you make a program you have to run the command to compile program.

Because of that, we need an IDE like Netbeans.

What is Netbeans?

Netbeans is one of the IDE (Integrated Development Environment) commonly used in Java programming.

If earlier we created a program with a text editor, now we will use Netbeans and can do compile there without having compile manual from Terminal.

Enak kan..

in that case, okay, Let's install Netbeans first:

How to Install Netbeans on Linux

Please Download Netbeans at: 📥 Netbeans Download Page

. Choose the one for Linux.

download netbeans

After that, Click the link provided to start the download.

link download netbeans

Then we will get the file Please change permissions this file so that it can be executed.

The method, right click and select Properties, on the tab Permission.. tick Is executable.


Click Ok to save.

In this way, the file can be directly executed.

Now try to double click on the file If it appears like this:

konfirmasi eksekusi

Click Execute.

source :

 1,568 total views,  4 views today

By admin


Leave a Reply

Your email address will not be published.

Web Hosting Murah Yang Terbaik Di Indonesia