answersLogoWhite

0

Why is the JVM platform dependent?

Updated: 8/10/2023
User Avatar

Wiki User

12y ago

Best Answer

That depends on how you look at it. The point of the JVM is to allow Java bytecode to be executed on any platform, regardless of what machine it was compiled on.

The actual implementation of the JVM, however, must be platform-specific.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Different OS will executes theire some own type of files

take an example for windows os, in this every file will be installed by .exe file and unix it will be another file executes

so jvm depends on OS

Technically speaking, the Java Virtual Machine specification is NOT platform-dependent, as it defines a standard virtual machine design. The actual implementationof the JVM spec on a specific Operating System and Hardware platform also does NOT have to be specific to that OS/Architecture - indeed, several JVM implementations are written to work on any POSIX-compliant platform. However, writing a fast JVM implementation generally requires considerably knowledge of the particular quirks of that platform, so that optimizations can be made.

Naturally, when producing the final binary JVM which will run on a specific platform, this has to be done using the native tools on that platform. That is, it is not possible to produce a single JVM binary that can run on several different platforms. While the codebase of a JVM can be platform independent, the final compiled binary cannot be, as the binary JVM must be in the particular hardware machine language of the particular OS/Hardware platform.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Because all code is interpreted by the "Java Virtual Machine" before execution. Each of the supported platforms has a port of the JVM. This means that the code in first translated into native code before being executed by the system. This makes Java considerably slower than C or C++.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

A compiled Java program (extension .class) is interpreted by a special program, the "Java Virtual Machine" (JVM). The JVM is available on many platforms. (Obviously somebody had to develop it separately for different platforms.)

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why is the JVM platform dependent?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is Java is platform dependent or independent?

Java is not machine dependent. High-level Java source code is compiled against the JVM which produces Java byte code, the lower-level native language of the JVM. At runtime, the JVM interprets the byte code to produce the required machine-dependent code. Every platform that supports Java has its own JVM, thus the same byte code can execute upon any supported platform. The translation from byte code to machine-dependent code is handled solely by the platform JVM.


Why is Java not 100 percent platform independent?

AnswerJava is platform independent while JVM is platform dependent. In Java ,you can compile code in to class file and you can run it in any OS without altering your code.But for interpreting class to bytes we need JVM .so it act as a bridge between your class file and OS. Now a days JVM is available for all OS.So Java attains platform independent.AnswerDepending on your definitions, no language may be truly platform independent. A language like Java needs a virtual machine to run the platform independent bytecode. But this virtual machine must run natively on a given physical machine, which means that the JVM in platform dependent. If someone tells you that Java is not completely platform independent, this is probably what they are referring to.


What are the two Java platform components?

Jvm & api


Is Jvm in the system?

The JVM (Java Virtual Machine) is a part of the JRE (Java Runtime Environment).The JRE is comprised of the JVM and the Class Library.The JVM takes the java language and compiles it into Bytecode which can then be interpreted as machine code by the platform(OS). The JVM will compile byte code specific to the OS it is being deployed upon. The JVM allows the Java language to be platform independent.


Can java run on any machine?

Yes, since it can only play in some computers and not all computers can read it. Every Java application needs a minimum system configuration requirement which if not met, the machine will not be able to run Java. Java the language itself is NOT machine dependent. To run a program written in Java, it depends on an implementation of the Java Virtual Machine specification existing for a given machine/OS platform. Thus, a program written in Java can be run on any OS/machine platform for which a JVM has been created.

Related questions

Is Java is platform dependent or independent?

Java is not machine dependent. High-level Java source code is compiled against the JVM which produces Java byte code, the lower-level native language of the JVM. At runtime, the JVM interprets the byte code to produce the required machine-dependent code. Every platform that supports Java has its own JVM, thus the same byte code can execute upon any supported platform. The translation from byte code to machine-dependent code is handled solely by the platform JVM.


JVM is platform dependent then why JAVA is platform independent?

The idea is that, once you have a JVM available for a platform, the same Java program works on different computers. This is unlike many other programming languages, which need to be recompiled for different platforms, or perhaps don't work even if recompiled, due to platform-specific differences.


Why is Java not 100 percent platform independent?

AnswerJava is platform independent while JVM is platform dependent. In Java ,you can compile code in to class file and you can run it in any OS without altering your code.But for interpreting class to bytes we need JVM .so it act as a bridge between your class file and OS. Now a days JVM is available for all OS.So Java attains platform independent.AnswerDepending on your definitions, no language may be truly platform independent. A language like Java needs a virtual machine to run the platform independent bytecode. But this virtual machine must run natively on a given physical machine, which means that the JVM in platform dependent. If someone tells you that Java is not completely platform independent, this is probably what they are referring to.


What are the two Java platform components?

Jvm & api


Is Jvm in the system?

The JVM (Java Virtual Machine) is a part of the JRE (Java Runtime Environment).The JRE is comprised of the JVM and the Class Library.The JVM takes the java language and compiles it into Bytecode which can then be interpreted as machine code by the platform(OS). The JVM will compile byte code specific to the OS it is being deployed upon. The JVM allows the Java language to be platform independent.


Can java run on any machine?

Yes, since it can only play in some computers and not all computers can read it. Every Java application needs a minimum system configuration requirement which if not met, the machine will not be able to run Java. Java the language itself is NOT machine dependent. To run a program written in Java, it depends on an implementation of the Java Virtual Machine specification existing for a given machine/OS platform. Thus, a program written in Java can be run on any OS/machine platform for which a JVM has been created.


Why JVM is platform independent?

by creating a jre spesific to each platform programmers can confidently write code in any platform and assume it willl also work in aany other. theirfore java is platform independent as bytecode would look the same on any platform, however will be implemented by a diffrent interpreter for each platform.


Are JVM is platform independent?

No, they must be designed for specific platforms. The compiled programs are platform-independent.


JVM is platform independent dependent why 2 which one is faster in execution Array List or Array why?

If im sending the answer if correct means u can accept otherwise any comments reply me. My mail is is murugadoit@gmail.com i know the answer is JVM is platform dependent, but Java is platform independent. Array is faster execution then ArrayList. Array is similar to pointer. You can store the values in index based. So you can easily store the data and also rectify the datas. So Array is faster then ArrayList but both are working datastructure in internally.


Why c is platform dependant?

Well, C is not platform dependent. You can compile C into source code on a Windows, Mac, Unix or any other operating system as long as you are using that type of computer. You could write code that can be compiled on almost any operating system. But the programs you write may or may not be able to move from system to system based on whether or not you use tools specific to that operating system. Java is not actually platform independent either because you need JVM to run it. It's just that most computers come with JVM installed. Both of the above are wrong. The C language specification itself is platform-dependent, as there are numerous places where ambiguities (both intentional and unintentional) cause different behavior according to how both the platform AND the C-compiler writer chose to behave. Thus, while it is possible to write a C program which is highly-portable, that program is still dependent on the exact implementation of the C compiler and OS it runs on. So, the behavior of a C program depends on the platform. The Java Language is platform INDEPENDENT, since it does NOT have the implementation ambiguities of C, and has a completely-standardized interface to all platforms (the JVM spec). Naturally, the JVM program is plaform dependent, as creating it to conform to the Java VM specification requires knowledge of the peculiarities of the platform.


Is cloud computing is platform dependent or independent?

c is platform dependent


How is it possible that the same Java program can run on different platforms?

Java source code is compiled into .class files, which are used by the Java Virtual Machine (JVM). The format of the .class file is the same for all platforms, and so the source code can be compiled the same way on each platform. The JVM, however, needs to be written to run on a specific platform. This is the part which converts Java bytecode to native bytecode, and is why you need to download the JRE (which contains the JVM) for a specific platform. Java source code is compiled into .class files, which are used by the Java Virtual Machine (JVM). The format of the .class file is the same for all platforms, and so the source code can be compiled the same way on each platform. The JVM, however, needs to be written to run on a specific platform. This is the part which converts Java bytecode to native bytecode, and is why you need to download the JRE (which contains the JVM) for a specific platform.