Step-by-Step Guide to Setting Up Your Java Environment

Step-by-Step Guide to Setting Up Your Java Environment

A properly configured environment is 80% of the success when starting to learn Java. Here is a step-by-step guide that works in 2026.

Step 1: Download the JDK
Go to the official website. We recommend JDK 21 (LTS) or JDK 23 (latest stable version as of February 2026).
Download the installer for your OS.

Step 2: Install the JDK
Run the installer and follow the instructions. Once complete, open a terminal and check:
java -version
javac -version
You should see version 21 or 23.

Step 3: Set Environment Variables (Windows)
Right-click on "This PC" → Properties → Advanced System Settings → Environment Variables.
Add/edit the JAVA_HOME variable: the path to the jdk-21 folder (for example, C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot).
In the Path variable, add %JAVA_HOME%\bin.

Step 4: Choose a code editor
The easiest option for beginners is Visual Studio Code + the "Extension Pack for Java" extension.
An alternative is IntelliJ IDEA Community Edition (free).
Step 5: Create your first program
In VS Code: File → New File → Hello.java

Insert the code:
public class Hello {
public static void main(String[] args) {
System.out.println("Hello from Bytecodejic!");
}
}
Save. In the terminal:
javac Hello.java
java Hello

Step 6: Check and fix common errors

"javac is not an internal or external command" → check JAVA_HOME and Path
"Error: could not find or load main class" → the file name must match the name of the public class
Encoding issues → save the file in UTF-8

After these steps, you are ready to start the Free Pack from Bytecodejic — and in 30–60 minutes you will write your first working code. Good luck!

Back to blog