- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why Java programs running on Android systems do not use the standard Java API and virtual machine?
The standard Java API and virtual machine are mainly designed for desktop as well as server systems. They are not that compatible with mobile devices. Because of this, Google has created a different API and virtual machine for mobile devices. This is known as the Dalvik virtual machine.
The Dalvik virtual machine is a key component of the Android runtime and is a part of JVM (Java Virtual Machine) developed specially for Android. The Dalvik virtual machine uses features that are quite important in Java such as memory management, multi-threading etc. The programs in Java are first converted into JVM and this is then interpreted into the DVM bytecode.
Details about both the JVM and the DVM are given as follows −
Java Virtual Machine
The Java Virtual Machine is an application that provides the run-time environment to execute the Java bytecode. It converts the bytecode into machine code. The Java Virtual Machine can perform multiple operations like loading the code, verifying the code, executing the code, providing run-time environment etc.
A diagram that illustrates the working of the Java Virtual Machine is given as follows −
Dalvik Virtual Machine
The Dalvik Virtual Machine is a version of the Java Virtual Machine that is optimized for low power handheld devices i.e. mobile devices. The DVM optimizes the mobile system for battery life, memory and performance in general.
Programs intended for Android are first written in Java and later compiled to bytecode for the JVM. After that, this bytecode is translated to Dalvik bytecode and stored in .dex and .odex files. These are Dalvik executable and Optimized Dalvik executable files respectively.
A figure that illustrates the working of the Dalvik Virtual Machine is given as follows −
- Related Articles
- What environment variables do I need to set up before I start running Java programs on my machine?
- What is JVM, Java virtual machine?
- What is Java Virtual Machine (JVM)?
- Explain Java Virtual Machine (JVM) Architecture
- Java Virtual Machine (JVM) Stack Area
- Explain Java Virtual Machine's Internal Architecture
- How to change/increase the heap size of the Java Virtual Machine in Java?
- Why is Java slower than C++ programs?
- Why do we use interfaces in Java?
- Display the amount of free memory in the Java Virtual Machine
- Why do some people need to use a dialysis machine ? What does the machine do ?
- Is there a need to import Java.lang package while running Java programs?
- Why do Java array declarations use curly brackets?
- What is Java API and what is its use?
- What are sales management systems? Why do we use them?