Why jvm is platform dependent




















The JVM and bytecode combined give Java its status as a "portable" language — this is because Java bytecode can be transferred from one machine to another. Given the previous information, it should be easier to figure out an answer to the original 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 — in other words, the JVM is not platform independent.

Job Hunting? Subscribe to our newsletter for more free interview questions. And kernel differs from OS to OS. Platform represents Operating System. When we compile your Java code then. Every machine has different architecture and different os.

Abhishek 12 May The reason is because every machine has different architecture. That s why we download JVM for windows or Mac ,linux etc. Binding of ByteCode to machine language Every machine is diferent. Arun 10 May Jvm is platform dependent why it coded in "c" language. And I think you will know ,when any program coded in "c" language then only you run on only local system. But you will think why jvm is not coded in "java".

Suppose when jvm is coded in java then it takes more step for conversion compare to "c" language. So jvm is platform dependent. Other Related Discussions. Why we cannot override static method? This executable code may be a sequence of machine instructions that can be executed by the CPU directly, or it may be an intermediate representation that is interpreted by a virtual machine.

This intermediate representation in Java is the Java Byte Code. Step by step Execution of Java Program: Attention reader!

Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. Whenever, a program is written in JAVA, the javac compiles it. The result of the JAVA compiler is the.

The bytecode generated is a non-executable code and needs an interpreter to execute on a machine. And finally program runs to give the desired output. Introduction Java is a platform-independent language. In other words, you can write your code once and then run it anywhere, on any platform that provides the environment to run it. The JVM should be present to execute the code.

The JVM is different for each platform. In the case of Java, platform independence does not mean that you can run the code anywhere; you can run it wherever the environment is provided. This is the key point of platform independence in Java. What is Platform? We can define a platform as the sum of hardware and software, that provides the environment to run the program.

We can realistically say that a platform is the computer and the operating system running on it. The operating system can be Windows, Mac, Linux, or any of many others.



0コメント

  • 1000 / 1000