fuddlepixelFuddlepixel coz tech is fun();

Installing Java on your system

Install Java development tool kit on your windows system, learn to create java environment path variables and start writing your first java code.

By Shubham Ramdeo
21 July 2018 · 3 mins read
# java 

Installing Java on your system

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: www.oracle.com 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: notepad-plus-plus.org”“>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 Hello.java 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\Hello.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 <filename.java>

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 fuddlepixel.com!


Share this :



Update me weekly ✉

Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.

I'm in ♥


Or follow us
   


About author

Shubham Ramdeo

Shubham Ramdeo

Shubham Ramdeo is the founder of Fuddlepixel. He is a geek, a writer, involved with many technical and humanity projects.

Meet me!



Recent





Related

java 

Top