I'm a Java newbie. Wanted to know if all Java SE
classes are available in Java ME
. If not why is it so?
No, only a subset is available, see http://java.sun.com/javame/technology/index.jsp for an introduction.
A brief overview is given in this Wikipedia article:
Noteworthy limitations
Compared to the Java SE environment, several APIs are absent entirely, and some APIs are altered such that code requires explicit changes to support CLDC. In particular, certain changes aren't just the absence of classes or interfaces, but actually change the signatures of existing classes in the base class library. An example of this is the absence of the
Serializable
interface, which does not appear in the base class library due to restrictions on reflection usage. Alljava.lang.*
classes which normally implementSerializable
do not, therefore, implement this tagging interface.Other examples of limitations depend on the version being used, as some features were re-introduced with version 1.1 of CLDC.
CLDC 1.0 and 1.1
- The Serializable interface is not supported.
- Parts of the reflection capabilities of the Java standard edition:
- The
java.lang.reflect
package and any of its classes not supported.- Methods on
java.lang.Class
which obtain Constructors or Methods or Fields.- No finalization. CLDC does not include the Object.finalize() method.
- Limited error handling. Non-runtime errors are handled by terminating the application or resetting the device.
- No Java Native Interface (JNI)
- No user-defined class loaders
- No thread groups or daemon threads.
It's worth noting that where J2ME versions of J2SE classes are apparently available, they often have a reduced API. So you can't always assume that code using 'available' classes will port straight over.
If memory serves, there are one or two methods with differening names too. Memory doesn't serve well enough right now to recall a specific example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With