Thursday, November 26, 2020

How to set up JAVA Development in Windows

what you learn on this page is:

What is required to run a java program?
What is JDK?
How to download JDK?
How to install JDK?
How to setup environment variables for JDK.
Run your first JAVA "hello world" application.

What is required to run a java program?

To run a java program you need to install JDK. without JDK you cant compile a java program and run it. That's all you need a text editor to write your code and JDK to compile your program and run it.

What is JDK?

JDK stands for Java Development Kit. JDK contains java implementations and JVM (Java Virtual Machine) when you compile a java program JVM which is in JDK take your program and generate Byte Code and when you execute your program then it uses that byte code to run your program in ender lying machine. that's why java is portable you can run the same program on any operating system and architecture because JVM just creates byte code and then with byte code it creates assembly that used by machines.

How to Download JDK?

You can download JDK from Oracle's official Site there are 64bit and 32-bit versions available but if you are going to install JDK 14 and later your machine has to be the support of 64 bit otherwise you have to install the older version if you are on a 32-bit machine.


How to install JDK?

After Downloading JDK 
double click on it and then hit next and click in install leave all the setting on default and after installation click on finish.
I have the whole video you can watch it here How to download and install JDK for java.

How to setup environment variables for JDK

that's the most important part after installing JDK you won't be able to compile java and run programs because your machine doesn't know where to look for the java compiler so we have to tell our machine where it is.

open your java installation path it should be this id you have installed JDK 64-bit

C:\Program FIles\JAVA\JDK15-0-1\bin

or if you have installed JDK 32-bit then it should be

C:\Program FIles (x83)\JAVA\JDK15-0-1\bin

in my case, I have installed JDK 15 on my machine so I have jdk-15-0-1 but in your case, it might be different.

Copy that path C:\Program FIles\JAVA\JDK15-0-1\bin from your machine
and then from the keyboard
Press Start Button and reach for "Edit the System and Environment variables" click on that.

then a window will open on that window click on "Environment Variables" then a new window will open on that window under the heading "user variables" find "path" and click on path open it and then click on new and paste your java path there.
and finally, close all the windows by clicking ok. It's all done
now open CMD 
press window + R from the keyboard and then type CMD and hit enter in CMD type
you will see something like
C:\Users\your username>
type javac and hit enter.
There should be a lot of information you see. it means everything is ok and now you can compile your Java programs.


if you this 
javac is not a internal or externat command

then it means that you did not have set environment variables correctly go back and do it again correctly

 here is the Video: How to download and install JDK and set Environment variables.


Run your first JAVA "hello world" application.

I have a video on it you can watch it: hello world program in Java


















Previous Post
Next Post

0 Comments: