File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes Java SE and Android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Java SE and Android" Watch "Java SE and Android" New topic

Java SE and Android

Peter Sorotokin
Ranch Hand

Joined: Jun 25, 2013
Posts: 36

In a book about Android is said :
From the mobile application developer’s perspective, Android is a Java environment, but the runtime isn’t strictly a Java VM. This accounts for the incompatibilities between Android and proper Java environments and libraries . If you have a code library that you want to reuse, your best bet is to assume that your code is nearly source compatible, attemp to compile it into an Android project , and then determine how close you are to having usable code.

I heard some packages like Swing and AWT does not work with Android . But in this book is said that every Java SE source code could be compiled under Android and that will work . What is the true thing about relation between Java SE and Android ? Are Swing and AWT source codes compiled and run under Android ?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Swing and AWT do not exist in Android, so while you can compile an Android app that uses them (because you're using a regular JDK for that), any attempt to run that code will end in tears

The Android libraries are most of Java 5 (except parts such as AWT and Swing and ImageIO), plus some extra stuff from Java 6, plus Apache Commons HttpClient and, plus the android.* packages. has all the available packages.
I agree. Here's the link:
subject: Java SE and Android
It's not a secret anymore!