top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What gives Java its 'write once and run anywhere' nature?

0 votes
365 views
What gives Java its 'write once and run anywhere' nature?
posted Jan 25, 2018 by Frank Lee

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

One of the initial "killer feature" of Java was supposed to be the write once, run anywhere nature of it. Earlier, it is not practically possible to have different versions of an application for different devices because the devices have variety of CPUs, operating system and browsers. The same code must work on all the computers, therefore we need a portable code . Portability refers to the ability to run a program on different machines. "Java is portable" , means that you can run Java bytecode on any hardware that has a compliant JVM (Java Virtual Machine).

The Java compiler compiles a java program (.java file) and converts it into class files (.class) that contain bytecodes , which is the intermediate language between source code and machine code . These bytecodes are not platform specific, so with the help of JVM (Java virtual machine), the java program can run on wide variety of platforms. The JVM (Java virtual machine) is platform dependent i.e its implementation differs from platform to platform (like windows, linux atc.), but these all JVMs can execute the same java bytecode .

This is something which can be termed as 'write once and run anywhere' . So, this means Java can be developed on any device, compiled into a standard bytecode and be expected to run on any device equipped with a JVM (Java virtual machine).

answer Feb 5, 2018 by Ammy Jack
...