在Android - Sun JVM上在DalvikVM上运行Java字节码 [英] Running Java bytecode on the Android - Sun JVM on top of DalvikVM

查看:151
本文介绍了在Android - Sun JVM上在DalvikVM上运行Java字节码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于java实现( OpenJDK )和Android的虚拟机DalvikVM都是开源的,因此必须能够在Google的DalvikVM上实现Sun的JavaVM。这将使在Android上运行基于JVM的应用程序和语言( Clojure,Jython )成为可能。


$

解决方案

OpenJDK使用的本地代码,因此它将是一个非平凡的端口...有至少一个VM( JikesRVM )是用Java编写的,不幸的是它不是一个完全工作的Java实现。



由于DalvikVM运行从.class文件转换的类,因此应该可以转换类。然后只有问题是当语言在运行时生成字节码 - 因为在DalvikVM上运行程序时,需要将生成的字节码转换为DalvikVM格式的额外步骤。



Hmmm .... sort of一个JITT(Just In Time Translator),在运行时在电话上将类文件转换为DalvikVM文件。我不知道这是多么缓慢。


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?

解决方案

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.

这篇关于在Android - Sun JVM上在DalvikVM上运行Java字节码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆