Is the JVM (Java Virtual Machine) platform dependent? What is the advantage of using the JVM, and having Java be a translated language?


Warning: include(../adsense.php) [function.include]: failed to open stream: No such file or directory in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 103

Warning: include(../adsense.php) [function.include]: failed to open stream: No such file or directory in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 103

Warning: include() [function.include]: Failed opening '../adsense.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 103

JVM translates bytecode into machine language

Every Java program is compiled into an intermediate language called Java bytecode. The JVM is used to both translate the bytecode into the machine language for a particular computer, and actually execute the corresponding machine-language instructions as well. The JVM and bytecode combined give Java its status as a "portable" language.

Machine language is OS dependent

Given the previous information, it should be easier to deduce an answer to the question. Since the JVM must translate the bytecode into machine language, and since the machine language depends on the operating system being used, it is clear that the JVM is platform (operating system) dependent. This fact can be verified by trying to download the JVM - you will be given a list of JVM's corresponding to different operating systems, and you will obviously pick whichever JVM is targeted for the operating system that you are running.

Join our mailing list to receive more questions from actual programmer interviews!


Warning: include(../adsense4.php) [function.include]: failed to open stream: No such file or directory in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 132

Warning: include(../adsense4.php) [function.include]: failed to open stream: No such file or directory in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 132

Warning: include() [function.include]: Failed opening '../adsense4.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 132

Warning: include(../adsense2.php) [function.include]: failed to open stream: No such file or directory in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 158

Warning: include(../adsense2.php) [function.include]: failed to open stream: No such file or directory in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 158

Warning: include() [function.include]: Failed opening '../adsense2.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/varoon10/public_html/programmerinterview.com/java/is-jvm-platform-dependent.php on line 158