Core Java

How to download Java 10 for Windows

Albeit you can use Java online, it is better to use it on a local machine. This tutorial is about downloading Java 10 on the Windows machine.

1. Downloading Java

Google is your friend! Search for “download Java 10” on Google, and hit the button on the first link.

Java 10 - Google Search
Google Search for downloading Java 10

Or, you can also click here to Download Java 10!

Consequently, you will now be on the page with different versions of JDK (Java Development Kit). Scroll down the page to find JDK 10. The picture below shows the JDK 10 that you need to download. Click on the one which is for Windows.

Java 10 - JAVA SE Development Kit 10
JAVA SE Development Kit 10

After clicking the link, you will be asked to accept the agreement. Accept it, and then you will need to sign in. If you don’t have an account on Oracle, kindly create it. And, then the downloading will begin.

Java 10 - Sign into Oracle
Sign into Oracle and download the set-up

2. Installing the set-up

After you have downloaded the setup, it is time to install it. You will have a dialog box opened as shown in the picture below.

Installation Begins with this Dialog Box

If you are interested in changing the default location of the installation folder, then you can change it by clicking on ‘Change’. Otherwise, you don’t need to make any changes here. Simply click next, and continue with the installation.

Custom Set-Up

When you click ‘Next’, the installation for JDK (Java development kit) will begin. This will take 5-10 minutes. Do not panic if you don’t see the status bar turning green as yet.

Installation of JDK begins

Similarly, you will be asked to change the location for JRE. Do the needful as required.

JRE location

Then, the installation for JRE (Java Runtime Environment) begins. This may take 10-15 minutes.

JRE Installation

Thus, Java has been installed successfully.

Java Installed Successfully!

Once you have installed the set-up, you will now need to add the path of JDK and JRE to the environment variables. For this, press start and search for environment variables.

Environment Variables

Click on Advanced > Environment Variables > New (System Variables) > Add the JAVA_HOME variable with the path of JDK-10 (as on your local machine).

Adding JAVA_HOME Environment Variable

Also, add the path of JRE 10 (bin folder) to the PATH System Variable.

Adding Path variable

And, hence, you have completed the entire installation process of Java – JDK and JRE.

3. Compiling a Java program with an example

There are two commands used to run and compile a Java program. These are javac and java.

Let us now compile a Java program using CLI. Given below is a basic program to add 2 numbers. Save the file with the extension ‘.java’. In this example, I have saved it as “Example.java”.

Example.java

import java.util.*;
class Example 
{
	public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int a = scan.nextInt();
	int b = scan.nextInt();
	System.out.println("SUM OF "+a+" and "+b+" is: "+(a+b));		

	}
}

So, there are two steps of compilation.

  1. javac filename.java
  2. java classname

Note: When you run the second command, do not add the extension of the class file. The class file is generated as soon as you run the first command.

Java program compilation

Hence, you have successfully compiled a program of Java. Kindly note if you find an error as “javac is not recognized as an internal or external command”, then please check the environment variables carefully.

4. Summary

Here’s a gist of what we have covered in the article:

  1. How to download and install Java
  2. Compiling a java program using the Command Line Interface (CLI).

5. Download the Source Code

This was an example of compilation of a Java program on local machine.

Download
You can download the full source code of this example here: How to download Java 10 for Windows

Simran Koul

Simran has graduated as a Bachelor of Engineering in Computer Science from Chitkara University. She has undergone a 6-months long comprehensive industrial training at the reputed Centre for Development of Advanced Computing (C-DAC), where she worked on a project including the likes of Java, JSP, Servlets while the UI-UX through the pioneering HTML, CSS and JS. Her inquisitive nature and the seed of curiosity keeps her on the toes to find material to write about. Along with her interests in Software Development, she is an ardent reader and always ready-to-write writer.
Subscribe
Notify of
guest

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

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button