Does android system include JVM?

user1019872 picture user1019872 · Feb 22, 2015 · Viewed 20.6k times · Source

I know android system include the Dalvik virtual machine(DVM) But i didn't understand if android system include JVM also Or DVM is a replacement for JVM? Thanks

Answer

phase picture phase · Feb 22, 2015

Programs are commonly written in Java and compiled to bytecode for the Java virtual machine, which is then translated to Dalvik bytecode and stored in .dex (Dalvik EXecutable) and .odex (Optimized Dalvik EXecutable) files.

In short, programs are compiled into JVM bytecode, which is then interpreted into DVM bytecode. Instead of running the compiled Java code, Dalvik compiles it and then translates that code into it's own code. It in some way is a replacement for the JVM.

An alternative runtime environment called Android Runtime (ART) was included in Android 4.4 "KitKat" as a technology preview. ART replaces Dalvik entirely in Android 5.0 "Lollipop".

ART, the Android Runtime, replaced Dalvik in Android 5.0. ART still uses the same .dex files, but they are instead translated into .elf(Executable and Linkable Format) files. This is another replacement for the JVM, as Java code is compiled into JVM bytecode, then translated into DVM bytecode, then translated into an ELF file and executed.

@Chris Thompson does a great job explaining DVM bytecode on Understanding disassembly of Dalvik code.

Sources: Wikipedia / Friends / Experiences