What is the relation between the OS and the JVM(Java)

S

Satya

How do Java relate to OS.
Will everything related to jdk ,jre work the same.
What is the difference between JDK and JRE.
 
J

jmcgill

Satya said:
How do Java relate to OS.
Will everything related to jdk ,jre work the same.
What is the difference between JDK and JRE.


Well, one vision of Java is that the bytecode machine could be an actual
machine, and some hardware java machines have been implemented.

But realistically in the land of the general purpose computer, the java
runtime is a program that runs under your OS. That means it uses your
OS for IO, it gets its memory from your OS, your OS schedules the
process and gives it permissions, and so on, just like any other program.

But the runtime is a special kind of program of course, because it is a
virtual machine implementation; essentially, it pretends to be a CPU
with its own datapath and control architecture, its own memory
management, and so on. And this virtual machine is able to execute Java
Byte Code as its machine language. You could write, and people have
written, this byte code as if it were an assembly language. You could
also make other languages compile to this byte code.

But the JVM does not have any special magic powers, it's just a program,
and it can only do what programs can do on your platform.

The JDK is something different. The JDK is the set of components
required to compile a java program into byte code. In common terms,
that is the compiler, the assembler, and the linker, but it does not
really fit that simple model very well. You can certainly study the
design of the compiler and there is a great deal of documentation available.

So the JDK usually includes a JRE. The JRE is the minimal set of
components required to *run* a java program. Some java programs with a
certain amount of complexity require a JDK to run, but generally this is
not the case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,477
Members
44,898
Latest member
BlairH7607

Latest Threads

Top