Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Compatibility between Java Editions

At the beginning of this section, I introduced Sun's Java tagline: "Write Once, Run Anywhere." Now that we've introduced Configurations, Profiles and a KVM, do you think this still applies? Well, the answer is, sort of.

Will J2SE applications run on J2ME?

J2ME is basically a slimmed down version of J2SE. Many components have been removed to keep the platform small and efficient. An obvious example is that of the Abstract Window Toolkit—many mobile devices do not have the screen capabilities to provide advanced user interface components such as overlapping windows and drop-down menus.

On the other hand, if you write J2SE code that adheres only to the classes that are available within the J2ME Configuration you are targeting, then your programs will run on both platforms. Keep in mind, such applications will most likely be very constrained, with little to no user interface, as J2ME and J2SE offer completely different APIs for handling the display.

Will J2ME applications run on J2SE?

The same rules apply here. If you limit the code to what is common on both platforms, the answer is yes. However, the majority of software you write for a J2ME device will require special interface and event handling code. Thus, you are greatly limited to what types of programs will be appropriate for both platforms.

  • + Share This
  • 🔖 Save To Your Account