What Platform Independence actually means in Java🤔?

Chirag Darji
2 min readJun 2, 2021

In simple word platform independence means we can run our code any operating system. Better to say “Write once,Run anywhere”. So, Let’s first understand what is Platform?

Platform : Any hardware or software environment in which program runs, is know as platform. Since we know that Java has JRE(Java Runtime Environment) and API, it is call Platform.

Let’s understand Platform dependent means, when I compile C program on window it converts our code to Machine code with extension .exe, then we run this .exe on same cmd for output. Similarly if we compile our code on Linux it generates file with .out extension. So,We can not run .exe file on Linux machine. This is Platform dependent means we can run our code that supported platform only.

Java code is compiled by the compiler and converted into byte code. This byte code is a platform independent code because it can be run on multiple platforms i.e. Write Once and Run Anywhere(WORA).

Java applications are typically compiled to byte code that can run on any Java Virtual Machine (JVM) regardless of computer architecture.

The Java language typically compiles to a Virtual Machine a virtual CPU which runs all of the code that is written for the language. This enables the same ececutable binary to run on all systems that implement a Java Virtual machine (JVM). Java programs can be executed natively using a Java Processor. This isn’t common and is mostly used for embedded systems.

--

--

Chirag Darji
0 Followers

Senior Software Engineer. Passionate Software Engineer with 4+ years of experience. Talks about #Java #DSA #LLD #HLD #Distributed Systems #CloudComputing