With relaxation that Apple introduced for all the Java developers, more and more Open source Java tools are being made available for iOS. These tools run on all Apple devices i.e. iPhone and iPad.
Before it was not a possibility to write an application in Java that will run on iOS and developer had to code in Objective-C.
Objective-C is the Apple's code for iOS devices.
In September 2010, Apple relaxed its restrictions on development tools allowing other ecosystem developers to build iOS applications.
Now there are third-party open source frameworks and Oracle's ADF (Application Development Framework) Mobile that allows the developer to run Java on iOS.
Google has also provided an open source J2ObjC translator that translates Java code to Objective-C source code.
There are three categories of tools Open source Java iOS tools:
The second one uses client-side technologies that run Java code directly on the iOS devices. These tools use compile-time conversion to a native binary.
The third and last one, use Hybrid technologies such as Oracle's Application Development Framework. These tools disseminate server-side as well as client-side Java components.
There are now few open source applications/tools that can write Java code and run on an iOS device natively. Some of them are listed below:
Codename One created by Chen Fishbein and Shai Almog, is a cloud-based cross-compilations that allows the user to write their code in Java and converts it in Objective-C. It has a simulator and cloud based build servers.
A developer can create an application using Eclipse or NetBeans in java programming that is suitable for most of the developers across the world. Codename One translates all the code to native code and hence is faster in comparison to other iOS tools.
Codename One has a simple architecture making it better portable than HTML5.
RoboVM translates the main class of a program (Java byte-code) into native code (ARM or x86). It includes a Java to Objective-C Bridge and use the CocoaTouch APIs.
RoboVM compiles runtime classes like java.lang.Object, java.lang.String that runs directly on the CPU. It keeps a cache of compiled classes and only recompiles a new class. It also has an Ahead-Of-Time compiler based on LLVM, C bindings, and an Objective-C bridge.
A RoboVM plug-in for the Eclipse Java IDE is also available. A developer has two options either he/she can create the UI in Java or can use Apple's Interface Builder and Xcode to develop the UI. In case of later, the developer must copy the Nib file into RoboVM project and link it to the Java classes.
J2ObjC, designed by Google, is an open-source command-line tool that changes a code written in Java into Objective-C and helps the developer in making application for iOS platform.
Editing of generated files is not required.
Non-UI code of an application is written in Java while the UI code must be written in Objective C or Objective C++.
Android UIs are then shared using Android's API and web app UIs is shared using GWT. It also has Java annotations and a Java compatible library for Objective-C.
J2ObjC supports most Java language and runtime features like exceptions, inner classes, generic types, threads and reflection.
J2ObjC does not have platform-independent UI toolkit.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Comparing the various Open Source Java iOS Tools
Post your Comment