Java Docs

Java Documentation

Getting started with Java

Java is a high level, class based, object oriented programming language that is widely used across various operating systems.

How to Run Java

You can run Java on your computer using two methods:

  • Run Java online
  • Install Java on your computer

In this tutorial, you will learn both methods.

Run Java Online

To run Java code, you need to have a Java compiler installed on your system. However, if you want to start immediately, you can use our free online Java compiler.

Online Java Compiler – run Java code directly in your browser, no installation required.

Install Java on Your Computer

This guide will walk you through installing Java on Windows, macOS, or Linux.

  • Windows
  • Mac
  • Linux

Windows Installation Steps

  1. Download JDK (Java Development Kit)
  2. Run the Installer
  3. Configure Environment Variables
  4. Verify Installation

Step 1: Download JDK

Go to the official Oracle website to download the JDK:

Download Oracle JDKDownload OpenJDK

Choose the x64 MSI Installer to download.

Step 2: Run the Installer

Open your downloads folder, run the installer, and click Next to proceed.

Step 3: Configure Environment Variables

After installation, set environment variables so your system can locate Java.

C:\Program Files\Java\jdk-22\bin

Add this path to your PATH variable and create JAVA_HOME pointing to:

C:\Program Files\Java\jdk-22

Step 4: Verify Installation

java --version

If Java is installed correctly, version details will appear.

Run Your First Java Program

class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}

Save the file as HelloWorld.java and run:

javac HelloWorld.java
java HelloWorld

You should see Hello World printed to the command prompt.

Java Resources & Downloads

Java JDK, JRE and JVM

What is JVM?

JVM (Java Virtual Machine) is an abstract machine that enables your computer to run a Java program.

How Does a Java Program Work?

Java Source Code (.java)
        ↓
Java Compiler (javac)
        ↓
Java Bytecode (.class)
        ↓
JVM interprets/compiles
        ↓
Native Machine Code

What is JRE?

JRE (Java Runtime Environment) is a package that includes the JVM and libraries needed to run Java applications.

What is JDK?

JDK (Java Development Kit) includes the JRE, compilers, debugging tools, and everything required to develop Java applications.