tags:

views:

5753

answers:

4

Since both the java implementation (OpenJDK) and Android's virtual machine DalvikVM are opensource it must be possible to implement Sun's JavaVM on top Google's DalvikVM. This would make it possible to run JVM based apps and languages (Clojure, Jython) out-of-the-box on the android.

Is there an ongoing effort to produce such an implementation of the Sun JVM?

A: 

I don't think the problem is technical. In theory you can migrate OpenJDK to the iPhone for example, but there are legal restriction in place.

Peter Lawrey
Here is the license agreement for android: http://developer.android.com/sdk/download.html?v=android-sdk-windows-1.1_r1.zip . I don't see any legal barrier here.
Richard J. Terrell
Also, the Android OS is under Apache and GPL license: http://source.android.com/license . So, there is no legal restriction whatsoever.
Richard J. Terrell
+3  A: 

The OpenJDK makes use of native code so it would be a non-trivial port... there is at least one VM (JikesRVM) that is written in Java, unfortunately it is not a completely working implementation of Java.

Since DalvikVM runs classes that were converted from .class files it should be possible to convert the classes over. Then the "only" issue is when languages generate bytecode on the fly - for that it would require the extra step of converting the generated bytecode over to the DalvikVM format while the program is running on the DalvikVM.

Hmmm.... sort of a JITT (Just In Time Translator) that covertes class files to a DalvikVM files at runtime on the phone. I wonder how slow that would be.

TofuBeer
hm. like running vista in an x86 emu, inside a jvm, in 1995? :)
Richard J. Terrell
everything old is new again :-)
TofuBeer
A: 

In the meantime I have found a possible solution (only JavaME):

Richard J. Terrell
A: 

Porting OpenJDK to Android platform is possible. There are effort like : Shark, Zero and caciocavallo that vastly ease the port process (= no ASM, simple AWT peer). Plus Android is nothing but a linux kernel behind. The only question is when will it be done by anybody ?

By the way, both iphones and android phones got Jazelle compatible processor, somebody with very strong processor hacking skills would be very welcome to add Jazelle support to OpenJDK. Doing so, we could choose between : very light resource acceleration (Jazelle) and JIT ;-)

About iPhone, it is the same thing : a port is possible. Only Apple has put a section in the the iPhone license that clearly forbid VM usage. As per European law, to me, this license section is unlegal. Two reasons : You can not force/link buy of two of your product. Here I tune and Iphones are linked. You can not refuse to sell something that you can sell. Here as soon as a VM would be build for iPhone, if it is refused to be put on the iTune store, then this point will apply. Is there anybody that want to chalenge Apple licence legality on earth ? I don't think so, unhappy people will be flying to Android or any other platform.