JavaFX Mobile Architecture
|Figure 5. The JavaFX Mobile Application Architecture: The JavaFX API requires the JavaFX runtime environment and a JVM (in this case, presumably a Java ME JVM).|
JavaFX applications rely on a JavaFX runtime that runs on top of a Java Virtual Machine (JVM). In the case of mobile applications, JavaFX runs on a Java ME JVM (see Figure 5
and Figure 6
The current JavaFX API is divided into two categories of API elements: common and desktop. These categories are called profiles, and the elements they contain support various UI needs and platform capabilities specific to their profile. The common profile provides classes that are supported on both desktop and mobile devices. In other words, it provides the lowest common denominator UI for all platforms running on a JVM – be it a Java ME or Java SE JVM. The desktop profile provides more sophisticated capability in support of larger and more feature-rich platforms.
To create applications that will port across all form factors, developers should keep to the common profile. Developers who plan to deploy to a desktop platform or to a common desktop browser can opt to enhance their applications with the API offered in the desktop profile.
|Figure 6. The General JavaFX Application Architecture: The JavaFX API requires the JavaFX runtime environment and a JVM.|
Device Support and Application Provisioning
So which devices support JavaFX Mobile and how do you get your applications deployed to these devices? No products on the market currently ship with JavaFX. However, in their launch of JavaFX Mobile, Sun claimed a number of device manufacturers (including LG, Sprint, and Sony Ericcson) that had committed to offering JavaFX-enabled products in the near future.
While details on the specific JavaFX devices are sketchy at this time, Sun has made it clear that JavaFX is not meant for all mobile devices. Just because a device supports Java ME's MIDP/CLDC does not mean that it ultimately will support JavaFX. JavaFX is targeted for devices that comply with the Mobile Service Architecture (MSA) platform specification (JSR 248), which means that in addition to MIDP/CLDC JavaFX devices must support APIs that are characteristic of smart phones. These include personal information management (PIM), wireless messaging, 3D graphics, and mobile media.
As for how JavaFX applications will get deployed to the devices, essentially there are two options. Both are common to Java ME developers:
- Embed it to the device.
- Send it "over-the-air" to the device.
|Figure 7. The JavaFX SDK Installation Folder: Installing the JavaFX 1.1 SDK on a Windows box results in a bin, docs, emulator, lib, profiles, samples and servicetag set of folders.|
Because JavaFX runs on top of Java ME on MSA-endowed mobile devices, organizations should be able to take advantage of existing Java ME infrastructure and deployment mechanisms.
Building a JavaFX Mobile Application
Now that you know what JavaFX Mobile is, how do you build a JavaFX Mobile application? This section provides a beginner's guide to JavaFX Mobile development. It explains how to get the required technology, how to get an environment set up, and how to develop and run the Hello World application shown previously. A complete guide to JavaFX scripting is beyond that scope of this article, but refer to the Related Resources in the left column for some JavaFX tutorials and guides.
JavaFX applications officially can be built on Windows and Mac OS platforms. Sun is not providing a Linux offering yet, but developers have found a way to develop JavaFX 1.1 applications on Linux with a NetBeans 6.5 Plugin. Most importantly to this discussion, the JavaFX Mobile runtime and emulator are provided only for the Windows platform at this time.
Details about system requirements for both Windows and Mac OS are covered at the JavaFX.com site. You must have a relatively recent JDK (version 6 update 7 is at least required for Windows and version 5 update 13 is at least required for Mac OS).
Beyond the basic Java environment, you will need the JavaFX 1.1 SDK (available along with installation instructions at JavaFX.com). The downloaded install application is roughly 42MB for the Windows version and 28MB for Mac OS. When installing the SDK, if an appropriate Java SDK environment cannot be found, the install can take you through the process of getting and installing the Java SDK (see Figure 7 for a look at installing the JavaFX 1.1 SDK on a Windows box).