If Java is platform independent, why doesn't it run on all platforms?
Java runs mostly on all platforms. For running a Java program we need JVM on all
the platforms. If JVM is not installed on any platform than we are not able to
run Java programs. Java API has standard library and API that can run on any
platform. But the API of different languages like C and C++ is different for
different platforms. The API for Windows is totally different than the API for
Linux, and the API for Mac OS X is totally different again. When you write a C
or C++ program that uses the Windows API, then your source code will be largely
useless on a Linux system or on a Mac - because the Windows API doesn't exist
there. So we can run Java programs on any platform but before this we have to
install JVM for interpreting the byte code. The byte code of Java or war or jar
files can be taken to any platform and can be run directly on the platform
having JVM.
Comments
Post a Comment