Skip to content
UniCircle
EasyConceptualJava platform basics

Why is Java called platform independent?

Question JAVA-BAS-002

Java is described as "write once, run anywhere". What makes this possible, and is the JVM itself platform independent?

Show the explanation

javac does not produce machine code for one processor. It produces bytecode — instructions for an abstract machine, stored in .class files. Any computer with a JVM for its OS and CPU can run that same bytecode.

text
Hello.java --javac--> Hello.class (bytecode) --JVM on Windows / Linux / macOS--> runs

So the program is platform independent, but the JVM is not: each platform needs its own JVM build. Portability also depends on the code itself — hard-coded file paths like C:\data, OS-specific line endings or native (JNI) libraries can still tie a program to one platform.

Original UniCircle question. Last reviewed 22 Oct 2026.