No history yet

Introduction to Java

What is Java?

In the early 1990s, a team at Sun Microsystems, led by James Gosling, was working on a project to create a new programming language. Their goal was to build software for smart electronics, like early interactive TVs. The challenge was that these devices all used different computer chips and systems. They needed a language that could work everywhere, without being rewritten for each new device.

That project, initially called "Oak," evolved into Java. It was officially released in 1995 and quickly found a new home: the booming world of the internet. Its ability to run on different types of computers made it perfect for web applications.

Java is a general-purpose, object-oriented programming language. This means it's designed to build almost anything, and it organizes code in a way that models real-world objects, making complex software easier to manage.

A few key features made Java stand out. It was built to be reliable, secure, and relatively simple compared to languages like C++. But its most revolutionary idea was a philosophy called "Write Once, Run Anywhere."

Lesson image

Write Once, Run Anywhere

Before Java, programming was often tied to a specific operating system. If you wrote a program for Windows, you'd have to significantly change it to make it work on a Mac or a Linux machine. This was time-consuming and expensive.

Java solved this with a clever, two-step process. First, a developer writes the Java code. Then, a program called a compiler turns that human-readable code not into instructions for a specific computer, but into an intermediate language called bytecode.

This bytecode is the secret ingredient. It’s a universal, platform-neutral set of instructions. To run this bytecode, a computer just needs a special piece of software that can understand it. This software is the Java Virtual Machine, or JVM.

Think of bytecode as a blueprint for a piece of furniture written in a universal language. The JVM is like a skilled carpenter who can read that blueprint and build the furniture using the tools and materials available in their specific workshop (Windows, macOS, or Linux).

The Java Toolkit

To work with Java, you'll often hear three acronyms: JVM, JRE, and JDK. They represent different layers of the Java platform, each building on the last.

JVM

noun

The Java Virtual Machine. This is the core component that interprets Java bytecode and executes it on a specific machine. It's the abstract machine that enables Java's platform independence. You don't interact with it directly; it runs in the background.

The JVM is the engine, but an engine can't run on its own.

JRE

noun

The Java Runtime Environment. This is what most people need to run Java applications. It contains the JVM, along with a set of standard libraries and files that programs rely on. If you've ever seen a prompt to install Java to run a program, you were installing the JRE.

The JRE provides the complete environment for execution. But what if you want to create Java programs?

JDK

noun

The Java Development Kit. This is the full toolkit for developers. It includes everything in the JRE, plus tools for writing, compiling, and debugging Java code. The most important of these is the compiler (javac), which turns your source code into bytecode.

To summarize the relationship:

  • The JDK is for developers to build applications.
  • The JRE is for users to run applications.
  • The JVM is the core machine that makes it all possible.

By understanding these core concepts, you have the foundation for exploring how Java code is actually written. This platform-independent and robust design is why Java has remained one of the most popular and powerful programming languages for decades.