Java Reference
In-Depth Information
JavaFX on iOS
In 2007, Apple released the first version of iOS as the operating system for the iPhone. Originally, iOS was an
abbreviation for iPhone Operating System. Later, iOS became the operating system for other Apple devices including
the iPod Touch, the iPad and iPad Mini, and the second-generation Apple TV.
Applications for iPhone and iPad have to be written and compiled for iOS, and are made available via the Apple
App Store. The official site for the App Store is http://www.itunes.com/appstore .
the app Store should not be confused with the mac app Store, which is used to distribute oS X applications,
targeting desktop applications.
Note
Typically, iOS applications are written in Objective-C by using the Xcode development environment. Java
applications, by contrast, produce Java bytecode and are typically created using IDEs. Hence, a translation step is
required to have Java bytecode running in an iOS environment.
There are a number of approaches for running (translated) Java bytecode in iOS environments. At this moment,
the RoboVM project provides a convenient way to convert your JavaFX applications into native iOS applications.
RoboVM translates Java bytecode into iOS native code. The OpenJFX repository already contains an
implementation of JavaFX on top of iOS. The native calls required by the JavaFX platform are implemented using
native iOS calls. This allows JavaFX applications to achieve the same performance as native applications. RoboVM
translates not only your JavaFX Application classes, but also all classes that your application depends on.
There is no compiling, linking, resolving, or translation needed at runtime—this would not be allowed by Apple, which
keeps a strict policy as to what is allowed to be done in iOS applications. The schema in Figure 12-9 shows how it works.
Figure 12-9. Running JavaFX applications on top of RoboVM
As you can see from the schema, the RoboVM project contains both libraries as well as a compiler. The RoboVM
compiler compiles your JavaFX application file and all the required class files, and links it together with the required
libraries. RoboVM can produce executables for MacOS and for iOS.
The steps required to convert a JavaFX application into a native iOS application are described in the RoboVM
documentation pages. Currently, there are a number of options a developer can follow:
Use eclipse with the RoboVM plug-in.
Use maven with the RoboVM maven plug-in.
Directly execute the RoboVM compiler using a command-line approach.
 
 
Search WWH ::




Custom Search