JithinMechery
JithinMechery

Reputation: 53

Is the Java virtual machine machine dependent?

Is the JVM (Java Virtual Machine) platform dependent?

What is the advantage of using the JVM, and having Java be a translated language?

Upvotes: 1

Views: 2850

Answers (4)

wuchang
wuchang

Reputation: 3079

JVM itself is not independent. When you download jdk ,you can see that you have to choose you platform at first.You have to get clear your machine and OS type including unix-like ,windows or mac , 32-bit or 64-bit.But we always say that java is a platform-independent programming language,it is because JVM works as a middle-lays between your java application and the underline OS ,thus making java developer can just focus on the same JVM ,ignoring the isomerism of Operating Systems and hardware environments.

Upvotes: 0

James P.
James P.

Reputation: 19617

The parts of the JVM that dialogue with the operating system are platform dependant. But Java bytecode is independant, or at least supposed to be (edge cases probably exist).

The advantage of the JVM is simply to be able to compile once and be able to run executable bytecode on any platform which is supported. This is opposed to how things were before where you had to recompile to suit another OS or processor.

Btw, Java is not a translated/interpreted language like PHP or javascript. It's actually compiled with the JVM acting as a middleman or abstraction layer above an operating system.

Upvotes: 0

Elliott Frisch
Elliott Frisch

Reputation: 201527

There are many advantages to having a virtual machine (such as the Java Virtual Machine - with its' write once, run anywhere promises); among them are -

  1. Your application becomes operating system independent
  2. Your application becomes architecture independent

In other words, your application becomes (at least somewhat) future-proof as regards to the shifting landscape of competitive vendors. Still (IMO) the biggest advantage is that Java applications and frameworks run the same on Linux, Mac and Windows. Although each does need it's own implementation of the Virtual Machine (e.g. the actual Java Runtime Environment is platform specific, it is available in source form).

Upvotes: 0

Mike Dinescu
Mike Dinescu

Reputation: 55760

Yes, generally a JVM is platform dependent in the sense that it is implemented for the specific platform.

The advantage of using a JVM is that, at least in theory, it makes code written in Java platform agnostic and so the same code could run on any platform without modification to the code.

Upvotes: 1

Related Questions