<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mayur Bodhare</title>
    <description>The latest articles on DEV Community by Mayur Bodhare (@mayur_bodhare).</description>
    <link>https://dev.to/mayur_bodhare</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4167032%2F2a906238-cd94-4e9a-8793-d74e5f19b225.png</url>
      <title>DEV Community: Mayur Bodhare</title>
      <link>https://dev.to/mayur_bodhare</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mayur_bodhare"/>
    <language>en</language>
    <item>
      <title>JDK, JRE, JVM: Stop Mixing Them Up (Finally Explained Simply)</title>
      <dc:creator>Mayur Bodhare</dc:creator>
      <pubDate>Tue, 06 Oct 2026 17:38:17 +0000</pubDate>
      <link>https://dev.to/mayur_bodhare/jdk-jre-jvm-stop-mixing-them-up-finally-explained-simply-la</link>
      <guid>https://dev.to/mayur_bodhare/jdk-jre-jvm-stop-mixing-them-up-finally-explained-simply-la</guid>
      <description>&lt;p&gt;When I started learning Java, three words kept confusing me: &lt;strong&gt;JDK&lt;/strong&gt;, &lt;strong&gt;JRE&lt;/strong&gt; and &lt;strong&gt;JVM&lt;/strong&gt;. They sound alike, people use them as if they mean the same thing, and most tutorials just say "install the JDK" without explaining why.&lt;/p&gt;

&lt;p&gt;Once I understood the journey your code takes, from the moment you type it to the moment it runs, everything made sense. Let's walk through it step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: You write Java code
&lt;/h2&gt;

&lt;p&gt;It starts with you, the developer. You write code in a plain text file that ends with &lt;code&gt;.java&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Hello&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, world!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file is for humans. Your computer cannot run it directly, because processors don't understand Java. They only understand machine code, which is just 0s and 1s.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: The compiler turns it into bytecode
&lt;/h2&gt;

&lt;p&gt;Next, you run the Java compiler, called &lt;code&gt;javac&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;javac Hello.java
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The compiler reads your code and creates a new file called &lt;code&gt;Hello.class&lt;/code&gt;. This file contains &lt;strong&gt;bytecode&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Bytecode is not the final machine code. It's a middle form: simpler than your Java code, but not tied to any particular computer. Hold on to that last part, because it matters a lot later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: The JVM runs the bytecode
&lt;/h2&gt;

&lt;p&gt;Now the &lt;strong&gt;JVM (Java Virtual Machine)&lt;/strong&gt; comes in. Think of it as a small computer that lives inside your real computer. It reads the bytecode and runs it, translating it into instructions your actual processor understands.&lt;/p&gt;

&lt;p&gt;When you run this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java Hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the JVM looks for one specific starting point:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's why every Java program needs this exact line. It's the front door. If the JVM can't find it, it doesn't know where to start.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: JRE gives the JVM its tools
&lt;/h2&gt;

&lt;p&gt;The JVM can't work alone. Your program probably prints text, reads files, uses lists and so on. All of that comes from ready-made code called &lt;strong&gt;libraries&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So we put the two together:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;JRE (Java Runtime Environment) = JVM + libraries&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The JRE is everything you need to &lt;strong&gt;run&lt;/strong&gt; a Java program. If you only want to use a Java app and not build one, the JRE is enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: JDK is for people who build things
&lt;/h2&gt;

&lt;p&gt;Now what if you want to &lt;strong&gt;write&lt;/strong&gt; Java programs? You need the compiler (&lt;code&gt;javac&lt;/code&gt;), a debugger and other developer tools. These come in the &lt;strong&gt;JDK (Java Development Kit)&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;JDK = JRE + development tools&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The whole picture
&lt;/h2&gt;

&lt;p&gt;Here is the nesting. Each one sits inside the next:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+------------------------------------------+
|                                          |
|   +----------------------------------+   |
|   |                                  |   |
|   |        +----------------+        |   |
|   |        |      JVM       |        |   |
|   |        +----------------+        |   |
|   |                                  |   |
|   |               JRE                |   |
|   +----------------------------------+   |
|                                          |
+------------------------------------------+
                   JDK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple way to remember it:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;When you need it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;JVM&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The engine that runs bytecode&lt;/td&gt;
&lt;td&gt;Always (it's inside the others)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;JRE&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;JVM + libraries&lt;/td&gt;
&lt;td&gt;To run Java programs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;JDK&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;JRE + compiler and tools&lt;/td&gt;
&lt;td&gt;To write Java programs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you're a developer, install the &lt;strong&gt;JDK&lt;/strong&gt;. It already includes the other two.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the OS and hardware fit in
&lt;/h2&gt;

&lt;p&gt;Below all of this sits your operating system (Windows, Linux or macOS) and then the hardware.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Your Java code (.java)
          |
          v
     javac compiler
          |
          v
   Bytecode (.class)
          |
          v
+---------------------+
|  JRE (JVM + libs)   |
+---------------------+
|         OS          |   &amp;lt;- Windows / Linux / macOS
+---------------------+
|         HW          |
+---------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your Java program never talks to the OS directly. It talks to the JVM, and the JVM talks to the OS. This is the secret behind the big idea of Java.&lt;/p&gt;

&lt;h2&gt;
  
  
  The big idea: WORA
&lt;/h2&gt;

&lt;p&gt;You'll hear the short form &lt;strong&gt;WORA&lt;/strong&gt;, which means &lt;strong&gt;Write Once, Run Anywhere&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Why does this work? Think about the alternative. In a language like C, the compiler turns your code straight into machine code for one specific system. A program compiled for Windows won't run on Linux, so you have to compile it again for each one.&lt;/p&gt;

&lt;p&gt;Java takes a different path:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You compile &lt;strong&gt;once&lt;/strong&gt; into bytecode, which belongs to no particular OS.&lt;/li&gt;
&lt;li&gt;Each operating system has its &lt;strong&gt;own JVM&lt;/strong&gt;, built specially for it.&lt;/li&gt;
&lt;li&gt;Every JVM understands the same bytecode.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So the same &lt;code&gt;.class&lt;/code&gt; file runs on Windows, Linux and macOS without any change. Only the JVM differs from system to system, and the JVM is the one that knows how to talk to its own OS. You write the code one time, and the JVM handles the differences.&lt;/p&gt;

&lt;p&gt;There is a small trade-off. Running through a JVM adds a layer, so it can be a little slower than code compiled straight for one machine. In practice, modern JVMs are very well optimized, and for most programs the freedom to run anywhere is worth far more than the small cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick recap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You write &lt;code&gt;.java&lt;/code&gt; code.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;javac&lt;/code&gt; compiles it into &lt;code&gt;.class&lt;/code&gt; bytecode.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;JVM&lt;/strong&gt; runs the bytecode, starting from the &lt;code&gt;main&lt;/code&gt; method.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;JRE&lt;/strong&gt; is the JVM plus libraries, so you can run programs.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;JDK&lt;/strong&gt; is the JRE plus developer tools, so you can build programs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WORA&lt;/strong&gt; works because bytecode is the same everywhere, and each OS has its own JVM to run it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you see it as one journey (code → bytecode → JVM → OS → hardware), the three confusing names stop being confusing. They are just layers, each one wrapped around the one before it.&lt;/p&gt;

&lt;p&gt;If this helped, or if I got something wrong, let me know in the comments. I'm still learning too. 🙂&lt;/p&gt;

</description>
      <category>java</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
