tags:

views:

295

answers:

6

Can the Android JVM run on a PC also?

or is it limited to working on a mobile device only?

From what I understand, when you develop using eclipse it is emulated, not running the actual jvm correct?

A: 

Yes it can, but it have to be ported to the actual PC architecture. No such thing exist ( yet ) AFAIK

OscarRyz
Well it has been ported to netbook architecture, as you can buy netbooks that run Android.
mbaird
+1  A: 

Yes, the Android SDK ships with an emulator to test your applications on PC.

Programs are compiled into Dalvik executable bytecode not Java bytecode. See http://en.wikipedia.org/wiki/Dalvik_virtual_machine for more details.

Kristian
A: 

On a sidenote: Is the emulator really running the Dalvik bytecode or does the Android SDK use the Java VM for that?

Axel Gneiting
Is this an answer or a comment ? ( or a question ? )
OscarRyz
-1 because this is a question...
Bruno Brant
This question is closely related to the authors initial post so I postet it here deliberately instead of opening another question.Sometimes I really get angry with some peoples attitude.
Axel Gneiting
+5  A: 

Yes and no. The Android VM is actually called Dalik VM. It executes dalvik executables (dex) which are normally packaged as Android Packages (apk) file. The dex files are created from Java byte code files (output of a java compile, .class files) which run on a regular jvm. Currently the Dalvik VM runs on ARM and MIPS based processors. When you talk about running on a PC I assume you are talking about a x86 based computer. In this case you need to use an emulator to run the vm. The standard emulator that is shipped with the Android SDK uses qemu (qemu site) to run emulator the standard arm processor.

There is also a porting effort to x86 under way but the most common way currently is emualtion.

In terms of android running on netbooks it all comes down to the processor again...

Also keep in mind that if you want to run Android applications on a PC you need more than just the VM. You basically need to run the whole linux stack (e.g. including video codecs and so on). The easiest way to do that is to run an emulator.

Manfred Moser
A: 

Another clarification. The Android SDK emulator uses dalvik bytecode. The only way the jvm is involved is in the compilation process. Java source code -> java byte code -> davlik executable code...

Manfred Moser
+1  A: 

all the other answers are wrong. if you really do just want the VM, you can run dalvikvm on Linux.

you'll have to build it yourself though... see my answer to http://stackoverflow.com/questions/1297678/how-do-i-make-isolated-dalvik for details on how to do that.

Elliott Hughes