How Java Virtual Machine Works

Опубликовано: 30 Июнь 2014
на канале: Techy Help
9,831
like

Can you tell me how Java Virtual Machine works?

Java Virtual Machine or JVM has the motto write once, run everywhere.

I know the motto, but I do not understand the how.

Because Java Virtual Machine compiles code at real time, AKA just in time compilation, you see slightly slower execution. But since you run JVM directly on your computer, this ensures that Java runs on every type of device.

And generates just as many errors, too.

JVM creates a runtime instance every time you start a Java application. It is supposed to kill the instance when the application completes.

It manages to crash often enough.

Java Virtual Machines terminate the JVM runtime when all non-daemon threads are running. If the daemon threads are running, it still goes on, but JVM can kill an application through the security manager using the exit method.

When something is found wrong by security, head to the exits. But how does JVM work?

Java source code is saved as .java source files, but it is translated into Java bytecode. When you run Java, the Java Virtual Machine converts the bytecode into machine instructions.

It has to be good, because a lot of languages now use the JVM. But won't it crash if I have more than one running?

Each Java application uses its own Java Virtual Machine.

So JVM is virtual, and I can have more than one JVM running?

That's right.

So I could have lots of different types of applications using JVM, and it won't error out.

No more than usual. There are several versions of JVM, too, though the most common version of JVM was written by Oracle, its creator.

So JVM is an execution method for any language that is written to use it.

And JVM is compatible with almost any device because it compiles code in real time using a native method interface and native libraries.

It's a code translator.

That's a fair way of looking at it.


Смотрите видео How Java Virtual Machine Works онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Techy Help 30 Июнь 2014. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 9,831 раз и оно понравилось like посетителям.