Why is the JVM not platform independent, given tha

2020-06-03 00:30发布

Just curious to know when java is made platform independent then are there any specific reasons JVM is made platform dependent..

标签: java jvm
13条回答
Emotional °昔
2楼-- · 2020-06-03 01:10

The JVM is not platform independent

The key here is that the JVM depends on the operating system – so if you are running Mac OS X you will have a different JVM than if you are running Windows or some other operating system. This fact can be verified by trying to download the JVM for your particular machine – when trying to download it, 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.

查看更多
▲ chillily
3楼-- · 2020-06-03 01:12

JVM translate the byte code which is universal to machine code which is machine dependent hence JVM is platform dependent. Due to this byte code java is platform independent.

查看更多
劫难
4楼-- · 2020-06-03 01:14

simply like - * - makes a +.

We all know Java is platform independent

but OS where we write the code is platform dependant

and Output should be platform independent so, we make jvm (which is in-between and installed with jre) platform dependent so that the output is independent.

查看更多
我想做一个坏孩纸
5楼-- · 2020-06-03 01:19

The JVM must be platform dependent to allow your Java to run on the specific platform. A JVM for Windows will translate your Java into different system calls than a JVM for OS X.

查看更多
Lonely孤独者°
6楼-- · 2020-06-03 01:21

No, JVM is platform dependent. The code written in Java is not platform dependent. If you write Java code on a Windows operating system you can run that code on Linux or other operating Systems. But the JVM for Windows and Linux is different. JVM are found in JRE and when you download JRE from Oracle it says JRE for Window, Linux and other operating systems

查看更多
女痞
7楼-- · 2020-06-03 01:22

JVM depends on operating system. For the code to be independent, something should be dependent and that is JVM. While downloading JDK it asks for which OS you want to download it for. Which clearly implies that JVM is platform dependent.

查看更多
登录 后发表回答