Introduction to Java
What Is Java?
Java is a high-level, general-purpose, object-oriented programming language. It was developed by James Gosling and his team at Sun Microsystems in the mid-1990s and is now maintained by Oracle.
Java is designed around one key idea:
“Write Once, Run Anywhere” (WORA)
This means that a Java program written on one operating system—such as Windows—can run on another operating system—such as Linux or macOS—without changing the source code. This is possible because Java programs are not executed directly by the operating system. Instead, they run on the Java Virtual Machine (JVM).
Java is widely used because it is:
-
Platform-independent
-
Object-oriented
-
Secure and robust
-
Multithreaded
-
Scalable
-
Backed by a large ecosystem and community
Where Java Is Used
Java is used across many types of software systems, from small desktop tools to very large enterprise applications.
1. Enterprise Applications
Java is one of the most popular languages for large business systems. Banks, insurance companies, e-commerce platforms, and government systems often use Java because it is stable, secure, and scalable.
Examples include:
-
Banking and payment systems
-
Insurance platforms
-
Customer management systems
-
Inventory and billing systems
-
Enterprise web applications
2. Web Applications
Java is commonly used on the server side of web applications. Frameworks such as Spring and Spring Boot make it easier to build REST APIs, microservices, and web backends.
For example, a website may use HTML, CSS, and JavaScript in the browser, while Java handles business logic, user authentication, database operations, and API services on the server.
3. Android Development
Java has historically been one of the main languages for Android application development. Although Kotlin is now also widely used, many existing Android applications and libraries are written in Java.
4. Big Data and Data Engineering
Java is important in the big data ecosystem. Many popular data-processing tools are written in Java or run on the Java Virtual Machine.
Examples include:
-
Apache Hadoop
-
Apache Spark
-
Apache Kafka
-
Elasticsearch
If you work with large-scale data processing, distributed systems, or data pipelines, Java knowledge can be very useful.
5. Desktop Applications
Java can be used to build desktop applications using libraries and frameworks such as:
-
JavaFX
-
Swing
-
AWT
These are less common today than web and mobile applications, but Java desktop applications are still used in internal business tools and specialized software.
6. Embedded and IoT Systems
Java is also used in some embedded systems, smart cards, set-top boxes, and Internet of Things (IoT) devices, especially where portability and security are important.
How Java Works: Source Code to Execution
When you write a Java program, you usually create a file with a .java extension. For example:
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, Java!"); } }This file is called source code.
The execution process is:
HelloWorld.java | | Java Compiler (javac) v HelloWorld.class | | Java Virtual Machine (JVM) v Program OutputStep 1: Write Source Code
You write human-readable Java code in a .java file.
Example:
System.out.println("Hello, Java!");Step 2: Compile the Code
The Java compiler, called javac, converts the .java source file into bytecode.
Bytecode is stored in a .class file.
Example:
HelloWorld.java -> HelloWorld.classBytecode is not specific to Windows, Linux, or macOS. It is an intermediate format understood by the JVM.
Step 3: Run the Program
The JVM reads the bytecode and executes it on your specific operating system.
This is why the same .class file can run on different platforms, provided each platform has a compatible JVM.
JDK, JRE, and JVM
Beginners often confuse JDK, JRE, and JVM. They are related but serve different purposes.
JDK ├── JRE │ ├── JVM │ └── Core Libraries └── Development Tools ├── javac ├── java ├── javadoc └── other toolsJVM: Java Virtual Machine
The JVM (Java Virtual Machine) is the engine that actually runs Java bytecode.
Its main responsibilities are:
-
Loading
.classfiles -
Verifying bytecode
-
Executing the program
-
Managing memory
-
Performing garbage collection
The JVM makes Java platform-independent. Different operating systems have their own JVM implementations, but they all understand the same Java bytecode.
Simple way to remember it:
The JVM runs Java programs.
JRE: Java Runtime Environment
The JRE (Java Runtime Environment) is what you need to run an already-compiled Java application.
It includes:
-
The JVM
-
Core Java libraries
-
Supporting runtime files
If you only want to run a Java application—such as a desktop tool or a compiled program—you generally need the JRE.
Simple way to remember it:
The JRE provides the environment needed to run Java programs.
JDK: Java Development Kit
The JDK (Java Development Kit) is what you need to develop Java applications.
It includes everything in the JRE, plus development tools such as:
-
javac— the Java compiler -
java— the command used to run Java programs -
javadoc— documentation generator -
jar— tool for packaging Java files -
Debugging and monitoring tools
If you want to write, compile, and run Java code, install the JDK.
Simple way to remember it:
The JDK is for Java developers.
JDK vs JRE vs JVM
| Component | Full Form | Main Purpose | Who Needs It? |
|---|---|---|---|
| JVM | Java Virtual Machine | Executes Java bytecode | Required by every Java program |
| JRE | Java Runtime Environment | Provides the environment to run Java applications | End users running Java applications |
| JDK | Java Development Kit | Provides tools to develop and compile Java programs | Java developers |
A useful comparison is:
JDK = Development tools + JRE JRE = JVM + Runtime libraries JVM = Executes bytecodeWhy Platform Independence Matters
In many languages, compiled programs are closely tied to a specific operating system and processor architecture. A program compiled for Windows may not run directly on Linux.
Java solves this using bytecode and the JVM.
Java source code | v Platform-independent bytecode | v Platform-specific JVM | v Runs on Windows, Linux, or macOSSo Java does not eliminate platform differences completely. Instead, it moves the platform-specific part into the JVM.
Key Takeaways
-
Java is a popular, object-oriented, platform-independent programming language.
-
Java is used in enterprise software, web backends, Android apps, big data systems, desktop tools, and embedded systems.
-
Java source code is compiled into bytecode.
-
The JVM executes bytecode and enables “Write Once, Run Anywhere.”
-
The JVM runs Java programs.
-
The JRE is used to run Java applications.
-
The JDK is used to develop Java applications.
-
As a learner, you should install the JDK because it includes both the compiler and the runtime environment.
0