I know some 'normal' Java (computer Java), and I want to run such a program on my Android device. Is this possible? If yes, how?
4 Answers
Generally, this is not possible as although Android-flavored Java has the same syntax and semantics as typical Java, it does not run on the same virtual machine (Google has its own VM that Android phones all ship with and which has a different byte code format than conventional Java VMs), nor does it use or have access to Oracle's Java standard library.
Google reimplemented most of the important elements (e.g. Google has its own implementation of HashMap, ArrayList, etc.) and ditched a lot of other stuff (e.g. there's no Swing package in Google's library).
You can do it quite easily as there are many ways to run Java apps on Android. Specific application called Java Emulators can do it quite easily.
These are the popular Java emulators for Android: viz, JBED, PhoneME, Jblend and NetMite. There are arranged in order of my preference. You can use PhoneME for unrooted devices; however, if your device is rooted try any of the remaining three applications.
If by 'normal' Java (computer Java) you mean Java Standard Edition (J2SE - the Java programs that usually run on a PC, like Eclipse, Vuze etc...) then the answer is most probably no. There is no way to run them directly on Android and there are no (at least not known to me) apps or modifications that allow it.
The apps (emulators) mentioned in other answers are for the J2ME (Java2 Micro Edition, also known as MIDP and applications as "midlets") environment. They are the Java applications for mobile devices that were popular before Android appeared.
- 70
- 1
- 3
- 15