{"id":19,"date":"2026-03-15T03:23:29","date_gmt":"2026-03-15T03:23:29","guid":{"rendered":"https:\/\/wp.devsarun.io\/?p=19"},"modified":"2026-03-15T03:23:29","modified_gmt":"2026-03-15T03:23:29","slug":"java-tutorial-for-beginners-1-intro-installation-guide","status":"publish","type":"post","link":"https:\/\/wp.devsarun.io\/index.php\/2026\/03\/15\/java-tutorial-for-beginners-1-intro-installation-guide\/","title":{"rendered":"Java Tutorial For Beginners 1: Intro &#038; Installation Guide"},"content":{"rendered":"<div class=\"t2b-blog-content\">\n<p>Ready to dive into the world of programming? Java is an amazing place to start, known for its power and versatility across countless applications. This first tutorial will get you acquainted with Java and walk you through installing everything you need, step by step, so you can write your very first program.<\/p>\n<h2>What is Java and Why Learn It?<\/h2>\n<p>Java isn&#039;t just another programming language; it&#039;s a cornerstone of modern software development. Created by James Gosling at Sun Microsystems (now Oracle) and released in 1995, Java was designed with a simple philosophy: &quot;Write Once, Run Anywhere&quot; (WORA). And that&#039;s exactly what it does, thanks to the Java Virtual Machine (JVM).<\/p>\n<p>But why should you learn Java, especially as a beginner? Well, it&#039;s got some pretty compelling features:<\/p>\n<p>*   **Platform Independent:** This is the big one. You write your code once, compile it into bytecode, and then that bytecode can run on any device that has a JVM, regardless of the underlying operating system. So, your Java app works on Windows, macOS, and Linux without needing separate versions.<\/p>\n<p>*   **Object-Oriented:** Java is built on the principles of Object-Oriented Programming (OOP). This approach helps you organize your code into reusable, modular components, making complex applications easier to manage and scale. It&#039;s a fundamental concept in modern programming, and Java is a fantastic way to learn it.<\/p>\n<p>*   **Robust and Secure:** Java has strong memory management, automatic garbage collection, and excellent exception handling, which helps prevent common programming errors. It&#039;s also designed with security in mind, making it a trusted choice for enterprise-level applications.<\/p>\n<p>*   **Multi-threaded:** Java supports multi-threading, meaning your programs can perform multiple tasks concurrently. This is crucial for building responsive applications that don&#039;t freeze up while doing heavy processing.<\/p>\n<p>*   **High Performance:** With its Just-In-Time (JIT) compiler, Java can achieve impressive performance, often rivaling compiled languages.<\/p>\n<p>So, where is Java used? Everywhere! You&#039;ll find Java powering:<\/p>\n<p>*   **Android Applications:** Most native Android apps are built using Java (or Kotlin, which runs on the JVM).<\/p>\n<p>*   **Enterprise Software:** Huge companies rely on Java for their backend systems, using frameworks like Spring and Hibernate.<\/p>\n<p>*   **Web Applications:** From e-commerce sites to government portals, Java is a common choice for robust web development.<\/p>\n<p>*   **Big Data Technologies:** Tools like Apache Hadoop and Apache Spark, essential for processing massive datasets, are written in Java.<\/p>\n<p>*   **Scientific Applications:** Many scientific and research projects use Java for its reliability and performance.<\/p>\n<p>*   **Internet of Things (IoT):** Java ME (Micro Edition) is used in embedded systems and IoT devices.<\/p>\n<p>For beginners, Java offers a massive community, tons of learning resources, and a mature ecosystem. Plus, it consistently ranks high for job demand. So, you&#039;re making a smart choice!<\/p>\n<h2>Understanding the Java Ecosystem: JDK, JRE, and JVM<\/h2>\n<p>Before we jump into installation, it&#039;s super helpful to understand a few key terms that make up the Java ecosystem. You&#039;ll hear these acronyms a lot, and knowing what they mean will clear up a lot of confusion.<\/p>\n<p>Let&#039;s break them down:<\/p>\n<p>*   **JVM (Java Virtual Machine):** Think of the JVM as the engine that runs your Java code. It&#039;s an abstract machine that provides a runtime environment where Java bytecode can be executed. When you hear &quot;Write Once, Run Anywhere,&quot; the JVM is the &quot;anywhere&quot; part. It translates the compiled Java bytecode into machine-specific instructions, allowing your program to run on different operating systems without modification. Every operating system has its own specific JVM implementation.<\/p>\n<p>*   **JRE (Java Runtime Environment):** The JRE is essentially the JVM bundled with the core Java class libraries and other supporting files. If you only want to *run* Java applications on your computer, the JRE is all you need. It doesn&#039;t include any development tools like compilers or debuggers. So, if you&#039;re just a user of Java software, you&#039;d install a JRE.<\/p>\n<p>*   **JDK (Java Development Kit):** This is what you, as a developer, will need. The JDK includes everything in the JRE (meaning it has the JVM and class libraries), *plus* a set of development tools. These tools are crucial for writing, compiling, and debugging Java applications. The most important tools are `javac` (the Java compiler) and `java` (the Java application launcher). So, if you want to *write* and *run* Java programs, you&#039;ll install a JDK.<\/p>\n<p>To put it simply: the JVM executes your code, the JRE lets you run existing Java programs, and the JDK lets you develop new Java programs. Since you&#039;re learning to code, we&#039;ll be installing the JDK.<\/p>\n<h2>Choosing Your Java Development Kit (JDK)<\/h2>\n<p>Okay, so you know you need a JDK. But which one? The Java landscape can feel a little confusing here, but don&#039;t worry, we&#039;ll simplify it.<\/p>\n<p>Historically, Oracle provided the primary JDK. However, licensing changes have made **OpenJDK** the preferred choice for most developers and enterprises. OpenJDK is the free, open-source reference implementation of Java, and many vendors provide their own distributions of it. These distributions are essentially OpenJDK with additional support, optimizations, or branding.<\/p>\n<p>Some popular OpenJDK distributions include:<\/p>\n<p>*   **Adoptium (Eclipse Temurin):** This is a very popular, community-driven, and open-source distribution. It&#039;s widely recommended for its reliability and ease of use.<\/p>\n<p>*   **Amazon Corretto:** Amazon&#039;s production-ready distribution of OpenJDK.<\/p>\n<p>*   **Azul Zulu:** Another well-regarded OpenJDK distribution.<\/p>\n<p>*   **Oracle OpenJDK:** Oracle also provides a free OpenJDK distribution, separate from their commercial Oracle JDK.<\/p>\n<p>For this tutorial, we&#039;ll recommend using **Adoptium&#039;s Eclipse Temurin** distribution. It&#039;s free, open-source, and works great across all major operating systems.<\/p>\n<p>Next, let&#039;s talk about **Java versions**. Java releases new versions every six months, but not all versions receive long-term support. For stability in production environments, developers often stick to **LTS (Long Term Support) versions**. The current LTS versions are Java 8, Java 11, Java 17, and Java 21. For beginners, starting with **Java 17 or Java 21** is an excellent choice, as they include many modern features and improvements.<\/p>\n<p>We&#039;ll proceed with installing a recent LTS version of Adoptium Temurin JDK.<\/p>\n<h2>Step-by-Step Installation Guide (Windows)<\/h2>\n<p>Installing the JDK on Windows is pretty straightforward. Just follow these steps:<\/p>\n<p>1.  **Check System Type:** First, make sure you know if your Windows is 64-bit. Most modern computers are, but you can check by going to `Settings &gt; System &gt; About` and looking under &quot;System type.&quot;<\/p>\n<p>2.  **Download the JDK:**<\/p>\n<p>*   Open your web browser and go to the Adoptium website: `https:\/\/adoptium.net\/temurin\/releases\/`<\/p>\n<p>*   On the page, select the latest **LTS version** (e.g., &quot;JDK 17&quot; or &quot;JDK 21&quot;).<\/p>\n<p>*   Choose &quot;Windows&quot; for the operating system and &quot;x64&quot; for the architecture.<\/p>\n<p>*   Download the **MSI** installer (e.g., `OpenJDK17U-jdk_x64_windows_hotspot_17.0.x_x.msi`).<\/p>\n<p>3.  **Run the Installer:**<\/p>\n<p>*   Once the download is complete, locate the `.msi` file and double-click it to start the installation wizard.<\/p>\n<p>*   Click `Next` on the welcome screen.<\/p>\n<p>*   Accept the license agreement and click `Next`.<\/p>\n<p>*   On the &quot;Custom Setup&quot; screen, ensure that &quot;Set JAVA_HOME variable&quot; and &quot;Add to PATH&quot; are selected. These are usually enabled by default, and they&#039;re crucial for your system to find Java easily. Click `Next`.<\/p>\n<p>*   Click `Install` to begin the installation.<\/p>\n<p>*   If prompted by User Account Control, click `Yes`.<\/p>\n<p>*   Once the installation is complete, click `Finish`.<\/p>\n<p>4.  **Verify the Installation:**<\/p>\n<p>*   Open the Command Prompt. You can do this by typing `cmd` in the Windows search bar and pressing Enter.<\/p>\n<p>*   In the Command Prompt, type `java -version` and press Enter. You should see output similar to:<\/p>\n<p>&#8220;`<\/p>\n<p>openjdk version &quot;17.0.x&quot;<\/p>\n<p>OpenJDK Runtime Environment (build 17.0.x+x)<\/p>\n<p>OpenJDK 64-Bit Server VM (build 17.0.x+x, mixed mode, sharing)<\/p>\n<p>&#8220;`<\/p>\n<p>*   Next, type `javac -version` and press Enter. You should see:<\/p>\n<p>&#8220;`<\/p>\n<p>javac 17.0.x<\/p>\n<p>&#8220;`<\/p>\n<p>*   If you see these version numbers, congratulations! Java is successfully installed on your Windows machine.<\/p>\n<h2>Step-by-Step Installation Guide (macOS)<\/h2>\n<p>Installing the JDK on macOS is also quite simple, often even easier than Windows.<\/p>\n<p>1.  **Check System Architecture:** Determine if your Mac uses an Intel processor (x64) or Apple Silicon (ARM64\/aarch64). You can find this in `About This Mac`.<\/p>\n<p>2.  **Download the JDK:**<\/p>\n<p>*   Go to the Adoptium website: `https:\/\/adoptium.net\/temurin\/releases\/`<\/p>\n<p>*   Select the latest **LTS version** (e.g., &quot;JDK 17&quot; or &quot;JDK 21&quot;).<\/p>\n<p>*   Choose &quot;macOS&quot; for the operating system.<\/p>\n<p>*   For architecture, select &quot;x64&quot; for Intel Macs or &quot;aarch64&quot; for Apple Silicon Macs.<\/p>\n<p>*   Download the **PKG** installer (e.g., `OpenJDK17U-jdk_x64_mac_hotspot_17.0.x_x.pkg`).<\/p>\n<p>3.  **Run the Installer:**<\/p>\n<p>*   Locate the downloaded `.pkg` file and double-click it.<\/p>\n<p>*   The installer will guide you through the process. Click `Continue`, `Agree` to the license, and then `Install`.<\/p>\n<p>*   You might be prompted to enter your macOS user password. Enter it and click `Install Software`.<\/p>\n<p>*   Once the installation is complete, click `Close`.<\/p>\n<p>4.  **Verify the Installation:**<\/p>\n<p>*   Open the Terminal application. You can find it in `Applications &gt; Utilities &gt; Terminal` or by searching with Spotlight (`Cmd + Space`).<\/p>\n<p>*   In the Terminal, type `java -version` and press Enter. You should see output similar to:<\/p>\n<p>&#8220;`<\/p>\n<p>openjdk version &quot;17.0.x&quot;<\/p>\n<p>OpenJDK Runtime Environment (build 17.0.x+x)<\/p>\n<p>OpenJDK 64-Bit Server VM (build 17.0.x+x, mixed mode, sharing)<\/p>\n<p>&#8220;`<\/p>\n<p>*   Next, type `javac -version` and press Enter. You should see:<\/p>\n<p>&#8220;`<\/p>\n<p>javac 17.0.x<\/p>\n<p>&#8220;`<\/p>\n<p>*   macOS installers typically set up the `PATH` environment variable automatically, so you should be good to go!<\/p>\n<h2>Step-by-Step Installation Guide (Linux &#8211; Ubuntu\/Debian)<\/h2>\n<p>For Linux distributions like Ubuntu or Debian, installing OpenJDK is often easiest using the package manager. We&#039;ll use `apt` here.<\/p>\n<p>1.  **Update Package List:** It&#039;s always a good idea to update your package list before installing new software.<\/p>\n<p>*   Open a Terminal (usually `Ctrl + Alt + T`).<\/p>\n<p>*   Type `sudo apt update` and press Enter. Enter your password if prompted.<\/p>\n<p>2.  **Install the JDK:** Now, you can install the desired OpenJDK version. We&#039;ll install OpenJDK 17 as an example.<\/p>\n<p>*   Type `sudo apt install openjdk-17-jdk` and press Enter.<\/p>\n<p>*   The system will show you the packages to be installed and ask for confirmation. Type `Y` and press Enter.<\/p>\n<p>3.  **Set Default Java (Optional, if multiple versions):** If you have multiple Java versions installed, you might want to set a default.<\/p>\n<p>*   Type `sudo update-alternatives &#8211;config java` and press Enter. This will show a list of installed Java executables. Choose the number corresponding to the OpenJDK 17 version you just installed.<\/p>\n<p>*   Do the same for the Java compiler: `sudo update-alternatives &#8211;config javac` and select OpenJDK 17.<\/p>\n<p>4.  **Verify the Installation:**<\/p>\n<p>*   In the Terminal, type `java -version` and press Enter. You should see output similar to:<\/p>\n<p>&#8220;`<\/p>\n<p>openjdk version &quot;17.0.x&quot;<\/p>\n<p>OpenJDK Runtime Environment (build 17.0.x+x)<\/p>\n<p>OpenJDK 64-Bit Server VM (build 17.0.x+x, mixed mode, sharing)<\/p>\n<p>&#8220;`<\/p>\n<p>*   Next, type `javac -version` and press Enter. You should see:<\/p>\n<p>&#8220;`<\/p>\n<p>javac 17.0.x<\/p>\n<p>&#8220;`<\/p>\n<p>*   If you see these version numbers, your Linux system is ready for Java development!<\/p>\n<h2>Your First Java Program: Hello World!<\/h2>\n<p>With Java installed, it&#039;s time to write your very first program! This traditional &quot;Hello World&quot; program will confirm everything is working correctly.<\/p>\n<p>1.  **Create a Directory:** Make a new folder somewhere on your computer to store your Java projects. For example, `C:JavaProjects` on Windows, or `~\/JavaProjects` on macOS\/Linux.<\/p>\n<p>2.  **Create Your Java File:**<\/p>\n<p>*   Open a plain text editor (like Notepad on Windows, TextEdit on macOS, or Gedit\/VS Code on Linux).<\/p>\n<p>*   Type the following code exactly as shown:<\/p>\n<p>&#8220;`java<\/p>\n<p>public class HelloWorld {<\/p>\n<p>public static void main(String[] args) {<\/p>\n<p>System.out.println(&quot;Hello, Java World!&quot;);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>*   Save this file as `HelloWorld.java` inside the `JavaProjects` folder you created. Make sure the file name matches the class name exactly, including capitalization, and ends with `.java`.<\/p>\n<p>3.  **Understand the Code (Briefly):**<\/p>\n<p>*   `public class HelloWorld { &#8230; }`: This defines a **class** named `HelloWorld`. In Java, all code lives inside classes.<\/p>\n<p>*   `public static void main(String[] args) { &#8230; }`: This is the **main method**, the entry point of your program. When you run a Java application, the JVM looks for this method and starts executing code from here.<\/p>\n<p>*   `System.out.println(&quot;Hello, Java World!&quot;);`: This line prints the text inside the parentheses to your console (the command prompt or terminal). `System.out` refers to the standard output stream, and `println` means &quot;print line.&quot;<\/p>\n<p>4.  **Compile Your Program:**<\/p>\n<p>*   Open your Command Prompt (Windows) or Terminal (macOS\/Linux).<\/p>\n<p>*   Navigate to your `JavaProjects` directory using the `cd` command. For example:<\/p>\n<p>*   Windows: `cd C:JavaProjects`<\/p>\n<p>*   macOS\/Linux: `cd ~\/JavaProjects`<\/p>\n<p>*   Once in the correct directory, compile your Java file using the `javac` command:<\/p>\n<p>`javac HelloWorld.java`<\/p>\n<p>*   If there are no errors, this command will create a new file named `HelloWorld.class` in the same directory. This `.class` file contains the Java bytecode that the JVM understands.<\/p>\n<p>5.  **Run Your Program:**<\/p>\n<p>*   Now that you have the compiled `.class` file, you can run it using the `java` command:<\/p>\n<p>`java HelloWorld`<\/p>\n<p>*   **Important:** Notice you don&#039;t include the `.class` extension here.<\/p>\n<p>*   You should see the output:<\/p>\n<p>&#8220;`<\/p>\n<p>Hello, Java World!<\/p>\n<p>&#8220;`<\/p>\n<p>Congratulations! You&#039;ve successfully written, compiled, and run your first Java program. This is a huge milestone!<\/p>\n<h2>Conclusion<\/h2>\n<p>You&#039;ve just taken your first big step into Java programming! Installing the JDK and running your first &#039;Hello World&#039; program are huge milestones. Now you&#039;re all set up for our next tutorial. What part of Java are you most excited to learn about first?<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ready to dive into the world of programming? Java is an amazing place to start, known for its<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20,31,19,36,35,44,39,24],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-beginners","tag-first","tag-guide","tag-installation","tag-intro","tag-ready","tag-tutorial","tag-world"],"_links":{"self":[{"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":1,"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/posts\/19\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.devsarun.io\/index.php\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}