在安卓上运行Java SE或Java ME应用是否可能?
http://en.wikipedia.org/wiki/Dalvik_(software)
然而,基础架构有很大的不同,如果没有更改和重新编译,你是无法让为桌面编写/编译的应用程序在Android上运行。
Supported The following standard packages are supported in Android as of the latest release candidate. Consult the Java 2 Platform Standard Edition 5.0 API documentation for information on how to use them.
* java.io - File and stream I/O * java.lang (except java.lang.management) - Language and exception * support * java.math - Big numbers, rounding, precision * java.net - Network I/O, URLs, sockets * java.nio - File and channel I/O * java.security - Authorization, certificates, public keys * java.sql - Database interfaces * java.text - Formatting, natural language, collation * java.util (including java.util.concurrent) - Lists, maps, sets, arrays, collections * javax.crypto - Ciphers, public keys * javax.net - Socket factories, SSL * javax.security (except javax.security.auth.kerberos, javax.security.auth.spi, and javax.security.sasl) * javax.sound - Music and sound effects * javax.sql (except javax.sql.rowset) - More database interfaces * javax.xml.parsers - XML parsing * org.w3c.dom (but not sub-packages) - DOM nodes and elements * org.xml.sax - Simple API for XML
Not supported These packages, normally a part of the Java 2 Platform Standard Edition, are not supported by Android.
* java.applet * java.awt * java.beans * java.lang.management * java.rmi * javax.accessibility * javax.activity * javax.imageio * javax.management * javax.naming * javax.print * javax.rmi * javax.security.auth.kerberos * javax.security.auth.spi * javax.security.sasl * javax.swing * javax.transaction * javax.xml (except javax.xml.parsers) * org.ietf.* * org.omg.* * org.w3c.dom.* (sub-packages)
Third party libraries In addition to the standard libraries listed above, The Android SDK comes with a number of third-party libraries for your convenience.
* org.apache.commons.codec - Utilities for encoding and decoding * org.apache.commons.httpclient - HTTP authentication, cookies, methods, and protocol * org.bluez - Bluetooth support * org.json - JavaScript Object Notation
不,没有Java ME支持。您需要更改用户界面以在Android上运行。
然而,Java SE的基础库大多得到了支持,但也有例外(例如没有Swing)。您仍需要为应用程序提供视图和意图,否则系统将无法启动它(没有内置的“控制台模式”)。
你可以很容易地做到这一点,因为有许多在Android上运行Java应用程序的方法。一个叫做Java模拟器的特定应用程序可以很轻松地完成这项工作。
Android上最流行的四种Java模拟器分别是JBED、PhoneME、Jblend和NetMite。它们按优先顺序排列。你可以在未root的设备上使用phoneme,但如果你的设备已经root了,请尝试使用另外三个应用程序中的任意一个。
要了解如何安装和配置所有这些应用程序,请参考链接:http://androiddelta.com/run-java-apps-android-using-best-java-emulators/。
我知道这是一个旧帖子,但是由于我在这里花了很长时间寻找自己的解决方案,所以我想分享给那些通过谷歌找到这个帖子的人。
我也尝试了像Jbed和Netmite J2ME Runner等上面的建议,并且运气不太好。
后来我发现了PhoneME: http://davy.preuveneers.be/phoneme/?q=node/28
在我看来,这是Android上最好的JavaME模拟器。