Is the Android operating system written in Java?
Anything written in Java must run in a Java Virtual machine therefore if Android is written in Java it must itself be running in some sort of JVM, so is it?
- According to the answers at this question a JVM doesn't need it's own operating system so why does Android exists and why doesn't Dalvik or someother JVM just run the apps itself?
-
1Don't forget that Android supports programming in C/C++ as well as Java. See the docs on the [Android NDK](http://developer.android.com/tools/sdk/ndk/index.html). Also, _"Anything written in Java must run in a Java Virtual machine"_ is wrong. Android does not run a Java Virtual Machine; it runs a [Dalvik Virtual Machine](http://en.wikipedia.org/wiki/Dalvik_(software)). – Ted Hopp Dec 01 '13 at 09:01
-
@TedHopp my understanding is Dalvik Virtual Machine is a type of Java Virtual Machine, when people say THE Java Virtual Machine they are referring to the one maintained by oracle. Is that wrong? – Celeritas Dec 01 '13 at 09:11
-
@Celeritas: A JVM can run Java bytecode. Dalvik runs .dex files. Apparently there are other differences as well. Ted's link explains this. – T.J. Crowder Dec 01 '13 at 09:12
-
@T.J.Crowder so you're saying that a JVM must be able to run bytecode and since Dalvik does not it's not a JVM. According to who must a JVM run bytecode? – Celeritas Dec 01 '13 at 09:18
-
2According to the [Java Virtual Machine Specification](http://docs.oracle.com/javase/specs/jvms/se7/html/index.html). From the Wikipedia article, there are many differences (apart from using bytecodes) between a JVM and a Dalvik virtual machine. For instance: _"Unlike Java VMs, which are stack machines, the Dalvik VM uses a register-based architecture."_ – Ted Hopp Dec 01 '13 at 09:24
3 Answers
This is basically covered by the Android Wikipedia page.
Android is written in layers. The main "OS" layer is based on the Linux kernel, which is written primarily in C. Some parts of what we think of as "the Android OS" (baked-in apps, some UI) are also written in Java.
The Java parts are run on something very like a JVM: Dalvik.
Because much of the software that makes up Android is not written in Java. Most Android apps are written in Java (although as Ted Hopp points out, the don't have to be). Anything that is written in Java (the Java parts of Android, and Java apps) is run in Dalvik.

- 1,031,962
- 187
- 1,923
- 1,875
According to Wikipedia, the core of Android is written in C, the UI is written in Java, and parts of it are written in C++. This is because Android is Linux, which was written in C.
The Java parts of Android do run in a JVM.
Android exists because Google's programmers created it. Dalvik does run the apps.
For more information, see Wikipedia's articles about Android and Dalvik.

- 6,302
- 3
- 32
- 48
1)Is the Android operating system written in Java?
No.
2)Anything written in Java must run in a Java Virtual machine therefore if Android is written in Java it must itself be running in some sort of JVM, so is it?
As it isn't written in Java the question's premiss is false.
3)According to the answers at this question a JVM doesn't need an operating system
The answers to that question don't say any such thing.
so why does Android exists and why doesn't Dalvik or someother JVM just run the apps itself?
Android is an operating system. Dalvik is a JVM.

- 305,947
- 44
- 307
- 483
-
RE: 3) JVM needs an operating system itself to run on, but JVM doesn't need an internal operating system. Read the question in the link. – Celeritas Dec 01 '13 at 09:21
-
Dalvik is not a JVM; they are quite different beasts. See the [Wikipedia page on Dalvik VM](http://en.wikipedia.org/wiki/Dalvik_%28software%29) and the [Java Virtual Machine Specification](http://docs.oracle.com/javase/specs/jvms/se7/html/index.html). – Ted Hopp Dec 01 '13 at 09:28
-
@Celentas As I didn't say the JVM does need an 'internal operating system', I don't understand the point of your first comment. The phrase is yours, not mine. – user207421 Dec 01 '13 at 19:26