How do you turn your computer into a machine that can run Java applications? That is exactly what this chapter solves: you will learn how to install and configure the Java Development Kit (JDK) and choose a simple text editor or IDE. For your 1Z0-811 exam, you must understand not only that these tools exist but also how they connect — because the exam loves to test the difference between the JDK, the JRE, and the JVM, and knowing how to set them up gives you a real head start.
Jump to a section
A simple way to picture Setting Up the Java Development Environment
Have you ever tried to cook a complicated meal only to realise you don’t have a sharp knife or a working oven?
Setting up a Java development environment is exactly like preparing a kitchen before cooking a meal. The Java Development Kit (JDK) is your set of professional kitchen tools — the chef’s knife, the heavy-bottomed pots, the digital thermometer. Without these tools, you can’t properly chop, sear, or bake. The JDK includes the Java compiler, which translates your human-readable Java code into instructions the computer can execute — like a recipe that turns raw ingredients into a finished dish.
Now, a recipe book (your code) is useless if you have nowhere to write it down. That’s where a text editor or Integrated Development Environment (IDE) comes in — it’s your kitchen counter and notepad combined. You could scribble on a napkin (a basic text editor like Notepad), but using a proper IDE is like having a kitchen island with built-in hooks for your utensils, a timer, and a spice rack. The IDE helps you write code faster by highlighting mistakes, suggesting fixes, and organising your files.
Finally, you need to set the oven temperature and preheat it — that’s setting the PATH environment variable. It tells your operating system exactly where your JDK tools are located, so when you type “javac” to compile, the computer knows to go to the right drawer and grab the right tool. Without the PATH, your computer shrugs and says “command not found,” like you standing in a kitchen with no idea where the chef’s knife is hidden.
When people say they “know Java,” they usually mean they can write code in the Java programming language. But writing code is only half the story. To actually run that code, you need a whole infrastructure of software tools. That infrastructure is called the Java Development Kit, or JDK.
Let’s break that down from the very beginning.
Your computer, no matter how powerful, only understands one language: machine code — a stream of 1s and 0s. Humans write code in a high-level language like Java, which looks much closer to English. Something has to translate your high-level Java code into that machine code. That something is the compiler, which is a program inside the JDK. The compiler is named “javac” (short for Java compiler). When you run javac on a file called Hello.java, it produces a new file called Hello.class. This .class file contains bytecode — an intermediate language that is not machine code yet, but is a step closer.
Bytecode is special because it is platform-independent. That means you can compile your code on a Windows laptop, and then run that same .class file on a Mac or a Linux server without recompiling. The magic that makes this work is the Java Virtual Machine, or JVM. The JVM is a program that reads the bytecode and translates it into the specific machine code of whatever computer it is running on. This is often summarised as “write once, run anywhere.”
Now, the JDK includes the JVM, but also includes a lot of other tools. One of the most important is the Java Runtime Environment, or JRE. The JRE is a subset of the JDK — it contains the JVM and the standard class libraries (pre-written code for common tasks like reading files, connecting to networks, and drawing windows), but it does NOT include the compiler or other development tools. If you only want to run a Java application, you only need the JRE. But if you want to write and compile Java code, you need the full JDK. This is a classic exam trap: they will ask which component is needed for development, and the answer is always the JDK, not the JRE.
Installing the JDK is straightforward. You go to the official Oracle website or use an open-source version like OpenJDK, download the installer for your operating system, and run it. The installer places all the JDK files in a folder (something like C:\Program Files\Java\jdk-21 on Windows, or /Library/Java/JavaVirtualMachines/jdk-21.jdk on macOS).
After installation, you need to set the PATH environment variable. The PATH is a system setting that tells your operating system which folders to search in when you type a command. By default, when you open a command prompt or terminal and type “javac,” the operating system does not know where javac lives. Setting the PATH tells it to look in the JDK’s bin folder, where javac and other tools are stored. Without setting the PATH, you would have to type the full path every time, like “C:\Program Files\Java\jdk-21\bin\javac” — which is tedious and error-prone.
Alongside the JDK, you need a place to write your Java code. You have two main options:
A basic text editor like Notepad (Windows), TextEdit (macOS), or Nano (Linux). These are simple programs with no special features for coding. You write every character yourself, and you must remember the exact syntax.
An Integrated Development Environment (IDE) like Eclipse, IntelliJ IDEA, or NetBeans. An IDE is a much more powerful tool that combines a text editor with a compiler, debugger, and many other helpers. For example, as you type, the IDE can highlight syntax errors in red, suggest variable names, and even automatically fix common mistakes.
The 1Z0-811 exam does not require you to use a specific editor or IDE — any will do. But you need to know that the code you write is saved in a .java file, and that file is then compiled with the JDK’s javac command to produce a .class file. Finally, you run that .class file using the java command (which invokes the JVM). This cycle of “edit, compile, run” is the fundamental workflow you will repeat thousands of times as a Java developer.
Download the JDK Installer
Go to the official Oracle website or adoptium.net (for OpenJDK). Choose the JDK version that matches your project's requirements, typically a Long-Term Support (LTS) release like JDK 17 or 21. Select the installer for your operating system (Windows, macOS, or Linux).
Run the Installer
Execute the downloaded installer file. Follow the on-screen instructions, accepting the default installation location (e.g., C:\Program Files\Java\jdk-17 on Windows). The installer places all JDK files, including javac.exe and java.exe, into the installation directory.
Set the PATH Environment Variable
Open your system's environment variable settings. Locate the 'Path' variable and add the full path to the JDK's bin folder (e.g., C:\Program Files\Java\jdk-17\bin). This tells the operating system where to find the Java tools when you type commands in the terminal.
Verify the Installation
Open a command prompt (Windows) or terminal (macOS/Linux). Type 'java -version' and 'javac -version'. If both commands display version information without errors, the JDK is correctly installed and the PATH is set. If you see 'command not found', revisit the PATH configuration.
Choose and Install an Editor or IDE
Select a tool for writing your Java code. For a beginner, Visual Studio Code with the Java Extension Pack is a great choice because it offers syntax highlighting and built-in terminal support. Alternatively, use a simple text editor like Notepad. Download and install your chosen tool.
Create, Compile, and Run Your First Program
Open your editor, create a file named Hello.java, and write a simple program (e.g., public class Hello { public static void main(String[] args) { System.out.println("Hello World"); } }). Save the file. In the terminal, navigate to the file's folder, run 'javac Hello.java' to compile, then 'java Hello' to run. You have just completed the essential edit-compile-run cycle.
Imagine you are a junior developer at a small company called GreenLeaf Analytics. Your team is building an application that helps farmers predict crop yields based on weather data. Your manager hands you a brand-new company laptop and says, “Please set up your Java development environment so you can start working on the rainfall prediction module by next Monday.”
Here is what you actually do, step by step, in a real business context.
First, you check what operating system the laptop has. It is running Windows 11. You open a browser and go to the official Oracle JDK downloads page. You see different versions: the latest stable version (JDK 21), an older long-term support version (JDK 17), and a newer early-access version (JDK 22). You ask a senior developer which version the project uses. They tell you the project is on JDK 17 because it is a long-term support release, meaning it will get security updates for years. You download the Windows x64 installer for JDK 17.
After the installer finishes, you open File Explorer and navigate to where the JDK was installed. You verify the presence of the bin folder, which contains javac.exe and java.exe. Now you need to set the PATH. You open System Properties, click “Environment Variables,” and find the Path variable under “System variables.” You click “Edit,” then “New,” and paste the full path to the JDK’s bin folder (something like C:\Program Files\Java\jdk-17.0.8\bin). You click “OK” on all the dialogs. To test the setup, you open a command prompt and type:
java -version
javac -version
Both commands return version information, confirming the PATH is correct.
Next, you need a text editor. Your company standard is Visual Studio Code, a lightweight but powerful code editor. You download and install it. Once installed, you install the Java Extension Pack, which adds features like syntax highlighting, code completion, and integrated debugging. Now your environment is ready.
You create a new folder on your desktop called “rainfall-predictor.” In VS Code, you create a file called Main.java and type a simple “Hello, GreenLeaf!” program. You open the integrated terminal in VS Code, type “javac Main.java” — you see no errors, and a new file called Main.class appears in the folder. Then you type “java Main” and the output appears. You have just completed the full edit-compile-run cycle in a real-world setting.
The key takeaway is that the company environment already has standards (which JDK version, which editor), and you must align your setup with the team. You also need to know how to verify your installation and how to troubleshoot common issues, like a missing PATH entry or a wrong Java version. In a professional setting, mastering this setup means you can immediately start contributing code, rather than spending hours debugging your environment.
The 1Z0-811 exam does not ask you to type commands or actually install software. Instead, it tests your understanding of the components and their relationships. Here are the exact topics and trap patterns you need to know.
First, memorise the three core acronyms and what they include:
JDK: Java Development Kit. Contains JRE + development tools (compiler, debugger, etc.). Used for creating and running Java programs.
JRE: Java Runtime Environment. Contains JVM + core libraries. Used only for running Java programs.
JVM: Java Virtual Machine. The engine that executes bytecode. It is part of both JDK and JRE.
The most common exam question type gives you a scenario and asks: “Which of the following is required to compile and run a Java program?” The correct answer is always the JDK, because the JRE does not include the compiler. A classic trap is to list “JDK and JRE” as a correct choice — but the JDK already includes the JRE, so that is redundant.
Another trap is around the “write once, run anywhere” concept. The exam might phrase it as: “Which component allows Java bytecode to run on any platform?” The answer is the JVM. Bytecodes themselves are platform-independent, but the JVM is platform-specific.
The exam also tests the file extensions:
.java files contain source code (what you write).
.class files contain bytecode (what the compiler produces).
They might ask: “What is the output of the javac command?” The answer is a .class file.
They also test the executable names:
javac is the compiler.
java is the launcher that starts the JVM.
A typical question: “Which command compiles a Java program?” The answer is javac.
Regarding the PATH environment variable, the exam focuses on why it is needed. They might ask: “What happens if the PATH does not contain the JDK bin directory?” The answer is that commands like javac and java will not be found unless you provide the full path.
Memory tricks they expect you to know:
The JDK is a superset of the JRE. Visualise a nesting doll: JDK contains JRE, which contains JVM.
The compiler (javac) translates source code to bytecode. The launcher (java) starts the JVM, which interprets bytecode.
You need the JDK to develop; you only need the JRE to run a finished program.
Finally, the exam sometimes asks about open-source alternatives like OpenJDK. They want you to know that OpenJDK is the reference implementation of the Java standard, and Oracle JDK is a commercial distribution with extra features. Both work for the exam’s purposes.
The JDK includes the JRE and development tools like the compiler (javac); you only need the JDK to compile and run Java programs.
The JVM is the platform-specific engine that executes platform-independent bytecode, enabling 'write once, run anywhere'.
The javac command compiles .java source files into .class bytecode files.
The java command launches the JVM to execute the bytecode contained in a .class file.
Setting the PATH environment variable allows you to run javac and java without typing their full installation paths.
An IDE such as Eclipse or IntelliJ IDEA integrates a text editor, compiler, and debugger, making Java development faster and less error-prone.
OpenJDK and Oracle JDK are two common JDK distributions; both are valid for development and the 1Z0-811 exam.
The JRE alone is insufficient for developing Java programs because it lacks the javac compiler.
These come up on the exam all the time. Here's how to tell them apart.
JDK (Java Development Kit)
Includes a compiler (javac) for creating Java programs
Needed for both development and running Java programs
Larger in size because it contains development tools
JRE (Java Runtime Environment)
Does not include a compiler; only runs pre-compiled code
Sufficient only for running Java programs, not creating them
Smaller in size because it omits development tools
Text Editor
Bare-bones interface with no code-specific features
Requires manual compilation via command line
Examples: Notepad, TextEdit, Nano
IDE (Integrated Development Environment)
Includes syntax highlighting, code completion, and debugger
Often includes built-in compiler and terminal integration
Examples: Eclipse, IntelliJ IDEA, NetBeans
javac Command
Compiles .java files into .class bytecode files
Does not execute the program; only produces bytecode
Output is a file with the .class extension
java Command
Launches the JVM to run the bytecode in .class files
Does not compile the code; expects bytecode input
Output is the program's runtime behaviour
Mistake
I need to install both the JDK and the JRE separately to compile and run Java programs.
Correct
The JDK already includes the JRE. Installing both separately is unnecessary and can cause version conflicts.
Beginners often see the separate download links on Oracle's website and assume both are required, not realising the JDK is a superset.
Mistake
Setting the PATH means I have installed Java correctly.
Correct
Setting the PATH only tells the operating system where to find Java tools. The actual installation must be completed first, and PATH configuration is a separate step.
People often confuse the installation process with the configuration step. A successful installation alone does not make Java accessible from the command line.
Mistake
Java bytecode can run on any operating system without any extra software.
Correct
Bytecode can run on any operating system that has a compatible JVM installed. The JVM itself is platform-specific and must be installed separately on each platform.
The phrase 'write once, run anywhere' is oversimplified by many beginners, who think it means no special setup is needed per platform.
Mistake
An IDE and a text editor are the same thing because both let you write code.
Correct
A text editor is a bare-bones tool for typing characters. An IDE includes features like a compiler, debugger, code completion, and project management built in.
Since both can be used to edit a .java file, beginners assume they are interchangeable, missing the significant productivity boost an IDE provides.
Mistake
The javac command runs my Java program.
Correct
javac compiles Java source code into bytecode. The java command runs the compiled bytecode by launching the JVM.
The similar-sounding names cause confusion. Many beginners try to use javac to run their program and then think something is broken.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
The JDK (Java Development Kit) is the full toolkit for developing Java programs and includes the JRE (Java Runtime Environment) plus development tools like the compiler. The JRE contains the JVM (Java Virtual Machine) and libraries needed to run Java programs. The JVM is the engine that executes Java bytecode.
The PATH variable tells your operating system which folders to search when you type a command like javac or java. Without it, you would have to type the full installation path every time, which is inconvenient and error-prone.
Yes, you can use any text editor to write Java code. However, an IDE (Integrated Development Environment) like Eclipse or IntelliJ IDEA provides helpful features like syntax highlighting, error checking, and code completion that make writing and debugging code much easier.
Bytecode is the intermediate code generated by the Java compiler (javac) from your source code. It is platform-independent, meaning it can run on any device that has a Java Virtual Machine (JVM). This is what makes Java “write once, run anywhere” possible.
No, you only need the Java Runtime Environment (JRE) to run a Java program. The JDK includes the JRE plus development tools, but the compiler is unnecessary if you are not writing or compiling code.
Oracle JDK is a commercial distribution with extra tools and long-term support, while OpenJDK is the free, open-source reference implementation. Both can compile and run Java programs, and either is fine for the 1Z0-811 exam.
You've finished Setting Up the Java Development Environment. Continue through the 1Z0-811 study guide to build a complete picture of the exam.
Done with this chapter?