How to Install Java and Set Up JDK on Windows: Step-by-Step Guide
Skills IT Academy Content Team
September 23, 2026

Java is one of the most widely used programming languages for software development, web applications, enterprise applications, backend systems, and many other types of software. Whether you are a college student, fresher, working professional, or someone planning to start a career in software development, installing Java correctly is one of the first steps in your programming journey.
One of the first questions beginners ask before starting Java programming is
How do I install Java and set up JDK on Windows?
Installing Java is not difficult, but beginners can sometimes face problems while downloading the correct JDK, configuring environment variables, setting the PATH, or checking whether Java is working correctly from Command Prompt.
This guide explains how to install Java and set up the Java Development Kit (JDK) on Windows step by step. It covers downloading the JDK, installing it, setting JAVA_HOME, configuring the PATH variable, checking the installation, compiling a simple Java program, and troubleshooting common installation problems.
Quick Answer: How to Install Java and JDK on Windows?
The basic process is
- Download the JDK for Windows.
- Run the JDK installer.
- Complete the installation.
- Find the JDK installation folder.
- Set the JAVA_HOME environment variable.
- Add the JDK bin folder to the Windows PATH.
- Open Command Prompt.
- Run java -version.
- Run javac -version.
- Compile and run a simple Java program.
If both java -version and javac -version work correctly, your JDK installation is generally ready for Java development.
What Is Java?
Java is a general-purpose programming language used to develop a wide range of applications.
Java is commonly used for:
- Backend development
- Enterprise applications
- Web applications
- APIs
- Cloud-based applications
- Desktop applications
- Large-scale business systems
- Software development
- Educational programming
Java is also known for its platform-independent approach.
The commonly used concept is
Write Once, Run Anywhere
Java source code is compiled into bytecode, which can run on systems that have a compatible Java runtime environment.
What Is JDK?
JDK stands for Java Development Kit.
The JDK provides the tools required to develop Java applications.
A JDK generally includes:
- Java compiler
- Java runtime components
- Development tools
- Debugging tools
- Java utilities
One of the most important tools included in the JDK is
javac
The javac command is used to compile Java source code.
For example:
javac HelloWorld.java
The compiler converts the Java source file into bytecode that can then be executed using the Java runtime.
JDK vs JRE vs JVM
Beginners often get confused between JDK, JRE, and JVM.
JDK
JDK = Java Development Kit
It is used for Java application development and includes development tools such as the Java compiler.
JRE
JRE = Java Runtime Environment
It provides the components required to run Java applications.
JVM
JVM = Java Virtual Machine
The JVM executes Java bytecode.
A simple way to understand the relationship is
JDK → Development
JRE → Running Java applications
JVM → Executing Java bytecode
For someone learning Java programming, the JDK is the important installation because you need development tools such as javac.
What Do You Need Before Installing Java?
Before installing the JDK on Windows, make sure you have:
- A Windows computer
- Administrator access if required
- Internet connection for downloading the installer
- Enough disk space
- Command Prompt or PowerShell for verification
You should also decide which JDK distribution and version you want to use.
For learning Java, it is generally useful to choose a currently supported JDK release rather than installing an outdated version without a specific reason.
Step 1: Download the JDK for Windows.
The first step is to download a JDK installer compatible with your Windows system.
JDK distributions may be provided by different organizations.
When downloading, pay attention to:
- JDK version
- Windows compatibility
- 64-bit architecture
- Installer format
- Project or course requirements
For most modern Windows computers, a 64-bit JDK installer is commonly appropriate.
After downloading the installer, locate the downloaded file in your Downloads folder.
Step 2: Start the JDK Installation
Double-click the downloaded JDK installer.
Windows may display a security or permission message.
If required, allow the installer to continue.
The JDK setup window should appear.
Follow the installation wizard.
You may see options related to:
- Installation location
- JDK components
- Destination folder
For beginners, the default installation location is generally easier to manage.
Step 3: Choose the JDK Installation Location
The installer may allow you to choose where the JDK should be installed.
A typical installation path may look similar to
C:\Program Files\Java\
Inside the folder, you may see a JDK directory containing the installed version.
For example:
C:\Program Files\Java\jdk-XX
The exact folder name depends on the JDK version you install.
Remember this location because you may need it when configuring JAVA_HOME.
Step 4: Complete the JDK Installation
Continue through the installation wizard.
Once the installation process finishes, Windows should have the JDK files installed on your computer.
However, installing the JDK does not always mean that every Java command will automatically work from every Command Prompt window.
This is where environment variables become important.
Step 5: Find the JDK Installation Folder
Open File Explorer and navigate to the folder where the JDK was installed.
For example:
C:\Program Files\Java\
You should see a JDK folder.
Open the JDK folder.
Inside it, you should find folders and files associated with the Java development environment.
One important folder is
bin
The path to this folder is important because it contains commands such as
java.exejavac.exe
For example:
C:\Program Files\Java\jdk-XX\bin
Step 6: Understand JAVA_HOME
JAVA_HOME is an environment variable that points to the JDK installation directory.
For example:
JAVA_HOME=C:\Program Files\Java\jdk-XX
The exact path depends on your installed JDK version.
Notice that JAVA_HOME normally points to the JDK directory itself, not the bin directory.
The basic structure is
JAVA_HOME
↓
JDK folder
Then:
JAVA_HOME\bin
points to the executable tools.
Step 7: Open Windows Environment Variables
To configure Java environment variables:
- Open Windows Search.
- Search for Environment Variables.
- Select the option related to editing system environment variables.
- Open the System Properties window.
- Select Environment Variables.
You will see sections for:
- User variables
- System variables
Depending on your requirements, JAVA_HOME can be configured in the appropriate environment-variable section.
Step 8: Create JAVA_HOME
In the Environment Variables window, select the option to create a new variable.
Set the variable name as
JAVA_HOME
Set its value to your JDK installation folder.
For example:
C:\Program Files\Java\jdk-XX
Do not manually replace XX with the example value. Use the actual folder name installed on your computer.
Save the variable.
Step 9: Add Java to the PATH.
The Windows PATH variable tells the operating system where it can find executable commands.
To run commands such as
Java
and:
javac
From Command Prompt, the JDK's bin folder should be available through PATH.
The path generally looks like this:
C:\Program Files\Java\jdk-XX\bin
Open the PATH variable and add the JDK bin directory.
If you have multiple Java versions installed, pay particular attention to which Java installation appears in PATH.
Step 10: Save the Environment Variable Changes
After creating JAVA_HOME and updating PATH:
- Click OK.
- Close the Environment Variables window.
- Close System Properties.
The changes should now be saved.
Step 11: Open a New Command Prompt
This step is important.
If Command Prompt was already open while you changed environment variables, close it.
Open a new Command Prompt window.
This allows Windows to load the updated environment variables.
You can open Command Prompt by searching for:
cmd
Step 12: Check the Java Version
Type the following command:
java -version
Press Enter.
If Java is correctly available through PATH, Windows should display information about the installed Java version.
The exact output depends on the JDK version and distribution installed.
Step 13: Check the Java Compiler
Now run:
javac-version
The javac command checks whether the Java compiler is available.
If it displays the installed compiler version, the JDK's development tools are accessible from Command Prompt.
This is particularly important for Java learners because compiling Java programs requires javac.
Step 14: Check JAVA_HOME
You can also check whether JAVA_HOME is configured correctly.
In Command Prompt, run:
echo %JAVA_HOME%
Windows should display the JDK installation path.
For example:
C:\Program Files\Java\jdk-XX
If the command returns the correct JDK directory, JAVA_HOME is configured.
Step 15: Create Your First Java Program
Once Java and the JDK are installed, you can test the setup by creating a simple Java program.
Open Notepad or a code editor and create a file named
HelloWorld.java
Add the following code:
public class HelloWorld {public static void main(String[] args) {System.out.println("Hello, World!");}}
Save the file.
Make sure the file extension is
.java
and not:
.java.txt
Step 16: Open Command Prompt in the Project Folder
Navigate to the folder containing your Java file.
For example:
CD Desktop
Or navigate to the folder where you saved HelloWorld. Java.
You can check whether the file is present using:
dir
You should see:
HelloWorld.java
Step 17: Compile the Java Program
Run:
javac HelloWorld.java
If the compilation succeeds, Java should generate a class file.
You may see:
HelloWorld.class
The .class file contains Java bytecode.
Step 18: Run the Java Program
Now run:
Java Hello World
You should see:
Hello, World!
Congratulations.
You have successfully:
- Installed the JDK
- Configured Java
- Configured PATH
- Configured JAVA_HOME
- Compiled Java code
- Executed a Java program
Why Is JAVA_HOME Important?
JAVA_HOME is commonly used by Java-based tools to identify the JDK installation.
Tools and frameworks may check JAVA_HOME when locating Java.
Examples of software commonly associated with Java development include:
- Maven
- Gradle
- Application servers
- Build tools
- Development environments
- Java-based command-line tools
Therefore, learning how to configure JAVA_HOME is useful for Java developers.
Why Is PATH Important?
PATH allows Windows to locate executable commands without requiring you to type their complete file paths.
Without PATH, you may need to run Java using a full path such as
"C:\Program Files\Java\jdk-XX\bin\java.exe"
With PATH configured correctly, you can simply use:
Java
and:
javac
This makes command-line Java development much easier.
Java Installation: Common Errors and Solutions
Even after installing Java, beginners may encounter errors.
Here are some common problems.
Error 1: 'java' Is Not Recognized
You may see an error similar to
'java' is not recognized as an internal or external command.
This usually means Windows cannot find the Java executable through PATH.
Possible causes include:
- JDK was not installed correctly.
- PATH was not configured
- An incorrect JDK path was added.
- Command Prompt was not restarted after changing PATH.
Verify that the JDK bin folder exists.
For example:
C:\Program Files\Java\jdk-XX\bin
Then verify that this folder is included in PATH.
Open a new command. Prompt and try:
java -version
Error 2: 'javac' Is Not Recognized
If:
java -version
works but:
javac-version
does not work; check whether the JDK bin directory is correctly configured.
Remember that Java is a JDK development tool.
This can also happen when Windows is using a different Java installation than the JDK you intended to use.
Error 3: JAVA_HOME Is Incorrect
If:
echo %JAVA_HOME%
shows an incorrect location, check the variable value.
Make sure JAVA_HOME points to the JDK installation folder.
For example:
C:\Program Files\Java\jdk-XX
It should not point to a nonexistent directory.
Error 4: Multiple Java Versions Are Installed
Sometimes a computer may contain multiple JDK versions.
For example:
- JDK version A
- JDK version B
- JDK version C
In this situation, Windows may use one Java version through PATH while JAVA_HOME points to another.
This can create confusion.
Check:
java -version
and:
javac-version
Also check:
echo %JAVA_HOME%
Make sure the configuration matches the Java version you intend to use.
Error 5: Java Works in One Terminal but Not Another
This can happen when the terminal was opened before environment variables were changed.
Close the terminal and open a new one.
Then test:
java -version
and:
javac-version
How to Check Which Java Windows Is Using
You can use:
where Java
This command can show the location of the Java executable that Windows is finding through PATH.
This is particularly useful when multiple Java installations exist.
You can also check:
where Java
to locate the Java compiler.
Should You Install JDK or JRE?
If your goal is to learn Java programming or develop Java applications, you should install a JDK.
The JDK provides development tools required to compile Java source code.
A runtime-only setup is not sufficient for normal Java development workflows because you need the compiler and other development utilities.
Which JDK Version Should Beginners Install?
Beginners should generally choose a currently supported JDK version appropriate for their learning or project requirements.
When joining a Java course, check which JDK version the instructor or course curriculum uses.
If you are working on an existing company project, use the Java version required by that project.
The exact JDK version can matter because different Java versions may have compatibility differences.
Java Installation for Students
Students learning Java should focus on getting the basic development environment working correctly.
A beginner setup can include:
- JDK
- Java compiler
- Command Prompt
- Code editor or IDE
- Basic Java projects
Once the JDK is working, students can start learning:
- Variables
- Data types
- Operators
- Conditions
- Loops
- Methods
- Arrays
- Object-oriented programming
- Exception handling
- Collections
- File handling
After learning core Java, students can move toward more advanced Java development.
Java Installation for Software Developers
Developers may need additional tools after installing the JDK.
A typical Java development environment may include:
JDK
↓
IDE / Code Editor
↓
Build Tool
↓
Java Application
Developers may use tools such as
- IntelliJ IDEA
- Eclipse
- Visual Studio Code
- Maven
- Gradle
- Git
- GitHub
The exact tools depend on the project and development workflow.
Setting Up Java in an IDE
After installing the JDK, you can configure it in a Java IDE.
When creating a Java project, the IDE may ask you to select a JDK.
You should select the JDK installed on your computer.
The exact steps vary depending on the IDE.
The important point is that the IDE needs access to a compatible JDK to compile and run Java applications.
Java Installation Checklist
After completing the installation, check the following:
Check 1: JDK Installation
Make sure the JDK folder exists in the installation location.
Check 2: JAVA_HOME
Make sure JAVA_HOME points to the correct JDK folder.
Check 3: PATH
Make sure the JDK bin folder is available through PATH.
Check 4: Java Version
Run:
java -version
and confirm that a Java version is displayed.
Check 5: Java Compiler
Run:
javac-version
and confirm that the compiler version is displayed.
Check 6: JAVA_HOME Verification
Run:
echo %JAVA_HOME%
and verify that the correct JDK path appears.
Check 7: Java Executable
Run:
where Java
to check which Java executable Windows is using.
Check 8: Java Compiler Location
Run:
where Java
to check the location of the Java compiler.
Check 9: Test Program
Create a simple Java program and compile it using:
javac HelloWorld.java
Check 10: Run the Program
Execute it using:
Java Hello World
If you see:
Hello, World!
Your basic Java environment is ready.
What Can You Do After Installing Java?
Once your JDK is installed, you can start learning Java step by step.
A practical learning path can look like this:
JDK Installation
↓
Java Basics
↓
OOP Concepts
↓
Collections
↓
Exception Handling
↓
File Handling
↓
JDBC
↓
SQL
↓
Java Projects
↓
Spring Framework / Spring Boot
↓
REST APIs
↓
Backend Development
↓
Real-World Projects
↓
Interview Preparation
This provides a structured path from basic Java programming toward professional software development.
Common Mistakes When Installing Java on Windows
Installing the Wrong Architecture
Make sure the JDK matches your Windows system architecture.
Forgetting PATH
Installing the JDK does not necessarily mean that Java and javac will be available from every terminal.
Incorrect JAVA_HOME
JAVA_HOME should point to the JDK installation directory.
Using an Old Terminal
Open a new Command Prompt after modifying environment variables.
Installing Multiple JDKs Without Managing PATH
Multiple Java versions can create configuration conflicts.
Not Testing Java
Checking only:
java -version
is not enough for someone learning Java development.
Also test:
javac-version
Saving Java Files With the Wrong Extension
Make sure your source file is
rather than:
HelloWorld.java.txt
Frequently Asked Questions
How do I install Java on Windows?
Download a compatible JDK installer for Windows, install it, configure JAVA_HOME and PATH if required, and verify the installation using java -version and javac -version.
Is JDK required to learn Java?
Yes, if you want to develop and compile Java programs, a JDK is the appropriate Java installation because it provides the Java compiler and development tools.
How do I check whether Java is installed?
Open Command Prompt and run:
java -version
You can also check:
javac-version
How do I check JAVA_HOME?
Run:
echo %JAVA_HOME%
The command should display the JDK installation directory if the variable is configured.
Why is JavaC not recognized?
Usually, Windows cannot find the JDK's bin directory through PATH, or the environment variables have not been refreshed in the current terminal.
What is the difference between Java and JDK?
Java refers to the programming language and platform, while the JDK provides the tools needed to develop Java applications.
Where is Java installed on Windows?
The JDK is commonly installed under a directory such as
C:\Program Files\Java\
The exact location depends on the installer and your selected installation settings.
How do I compile a Java program?
Open Command Prompt in the folder containing your . Java file and run:
javac FileName.java
How do I run a Java program?
After compilation, run:
java ClassName
For example:
Java Hello World
Can I install multiple JDK versions on Windows?
Yes, multiple JDK versions can be installed, but you need to manage PATH and JAVA_HOME carefully so that your development tools use the intended version.
Do I need an IDE to learn Java?
No. You can learn basic Java using the JDK, a text editor, and Command Prompt. An IDE can make development easier as your projects become larger.
Is Java installation enough to become a Java developer?
Installing Java is only the first step. You also need to learn Java programming, object-oriented programming, databases, SQL, development frameworks, projects, debugging, version control, and other software-development skills.
Final Takeaway
Installing Java on Windows is one of the first steps for anyone beginning a Java programming or software development journey.
The complete setup can be summarized as
Download JDK
↓
Install JDK.
↓
Find JDK Folder
↓
Set JAVA_HOME.
↓
Configure PATH.
↓
Open New Command Prompt
↓
Check java -version.
↓
Check the Java version.
↓
Create a Java Program
↓
Compile using javac.
↓
Run Using Java
A correctly configured JDK gives you the foundation required to start developing Java applications.
If you are a beginner, don't stop after installing Java. Start practicing small programs, understand core Java concepts, build projects, and gradually move toward advanced Java development technologies such as SQL, JDBC, Spring, Spring Boot, REST APIs, and backend development.
For students searching for Java training in Pune, it is also useful to check whether the training program includes practical coding, projects, debugging, Git/GitHub, database connectivity, Spring Boot, interview preparation, and real-world development practices rather than focusing only on Java theory.
Before joining any Java training program, compare the syllabus, trainer experience, practical sessions, projects, course duration, learning support, and career assistance to understand what you will actually learn.