# "Java is platform-independent" — but doesn't the JVM add a dependency? 🤔

I see this question a lot, so let's clear it up.

Yes, the JVM itself IS platform-dependent. There's a separate JVM build for Windows, Linux, and macOS. So where's the "independence" people keep talking about?

The answer: it's not about having *zero* dependency — it's about *where* that dependency lives.

The key difference vs. a traditional compiler (like GCC for C or C++):

→ With C, you compile source code separately on each OS, producing a different binary each time. A Windows `.exe` won't run on Linux. Want to support three platforms? Recompile and redistribute three times — forever, with every update.

In simple language, The end user using different platforms — someone who just wants to run your app, not develop software — would need a full compiler toolchain installed, and then you'd have to trust that compiling it on their machine produces a working, bug-free binary every single time. That's a lot to ask of a regular user.

→ With Java, you compile once, and the output (bytecode) is identical everywhere. The JVM doesn't compile your source — it translates that same bytecode into native machine instructions, at runtime, on whatever machine it's running on.

What this means in practice:

You ship a single `.jar` file. Anyone, on any OS, with a JVM installed, runs the exact same file. You never recompile per platform. The platform-specific work happens invisibly, on the user's machine, every time they run it.

So the dependency hasn't disappeared. It's just been isolated into one layer — the JVM — so your code and your distributed artifact never have to change.

That's the real portability Java offers: not "no dependencies," but "one artifact, everywhere."

\--- I hope this helps.
