Persiapan Pemrograman Java di Windows
80 / 100

How many bits do you use Windows? ?

Java Programming Preparation on Windows, Before starting, I suggest knowing in advance what type of Windows you are using.

Are you using 32-bit or 64-bit?

This is important, so that later you don't download the wrong one.

Okay, open, please Basic Information by right -clicking on Start Menu then select System.

Start Menu System

After that, window will appear Basic Information.

Basic Information Windows

From here, we can know the type of Windows used.

In the picture above, I use 64-bit. That means later I have to download a 64-bit program.

What is JDK ?

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 Development Kit

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 14.

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.

Cara Install JDK

Okay, to install the JDK.. we have to download it first.

Please download the JDK at: 📥 JDK Download Page 8

.

Halaman Download JDK

After that, we will get a ZIP file containing JDK. Please extract this file into C:\Program Files\.

extrak-jdk

So now we will have a new folder, that is java-se-8u41-ri.

folder-program-file

At this point we actually have the JDK installed. However, can't be used yet.

If you don't believe it..

Just try to open CMD, then type java or javac.

Then the result:

cmd-java

Order java and javac can't be recognized in CMD.

Order javac works to compile Java programs and java works to run Java programs.

So that these two commands can be recognized, then we have to register it on Environment Variable.

Let's do it:

Please click Start Menu, then type env. Then it will appear like this:

env

Please open the program Edit the system environment variables, so it will appear like this:

Environment var untuk Java

Click Environment Variables, then in the window that appears click New.

new var button

So it looks like this:

new env blank

Here we will create a new variable named JAVA_HOME and its value is the path address of the JDK.

The purpose of creating variables JAVA_HOME so that later installed JDK can be detected by Netbeans.

Open, please Windows Explorer, then go to the folder where we extracted the JDK earlier. Right click on address bar, then select copy address as text.

copy path

After that, return to the variable creation window and paste the address to the value of the variable JAVA_HOME.

var java home

After that, we will have a new variable with name JAVA_HOME. Next, please edit variables Path.

Click variable Path then click button Edit.

edit path

In the window that appears, click button New and fill it with %JAVA_HOME%\bin

add java bin path

After that, click OK to save all created variables.

oke

Now try to open CMD again, and type the following command:

java -version
javac -version
where java

Then the result:

java-cmd-tes

This means, We can use the JDK.

Let's try to make a program.

If you want to update the JDK..

If we want to update the JDK to the latest version, then all that needs to be done is:

  1. Download JDK from jdk.java.net
  1. ;
  2. Extract the ZIP file obtained to C:\Program Files\;
  3. Change variable value JAVA_HOME by address path from the latest JDK version;
  4. Save by clicking OK;
  5. Finished.

Hello World Program Creation Experiment

To make sure the JDK is installed correctly, let's try by making a program HelloWorld.

Please open Notepad, then type the following program code:

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

So it will be like this:

notepad-java

After that, save in folder Documents by the name HelloWorld.java.

save-java

Next, we will do compile program.

Please open CMD then type the following command:

cd Documents
javac HelloWorld.java

If there is no error, then the program will compile successfully.

compile

Now, we have a new file in the folder Documents by the name HelloWorld.class. This file is compiled from Java program HelloWorld.java.

hasil-compile

Next, go back to CMD and type the following command to execute the program.

java HelloWorld

Then the result:

run-java-cmd

The program we created was successfully executed.

How?

Easy isn't it?

Nah, in the future we will not do this again. Because it's quite tiring, if every make the program must compile manually by typing the command javac and java by CMD.

Because of that, we need Netbeans.

What is Netbeans?

Netbeans is an IDE (Integrated Development Environment) commonly used in Java programming.

If earlier we made a program with Notepad, now we will use Netbeans and can do compile there without having to manually type from CMD.

Enak kan..

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

How to Install Netbeans on Windows 10

Netbeans that we will install is Netbeans 12 LTS. This time, Netbeans 12 only available for 64-bit Windows. For those of you who use 32-bit Windows, try to use Netbeans 8.2.

Please Download Netbeans at: 📥 Netbeans Download Page

download netbeans
Page to download Netbeans

After that, Click the link that appears and the download process will start immediately.

source : https://www.petanikode.com/java-windows/

 1,396 total views,  4 views today

By cahyono arek ngalam

Thanks For All.

Leave a Reply

Your email address will not be published.

Web Hosting Murah Yang Terbaik Di Indonesia