Google releases tool to bridge back-ends for iOS and Android apps

The J2ObjC tool converts Android-friendly Java source code to Objective C, which is used to build iPhone and iPad apps. It can't be used as a shortcut to building iOS app user interfaces, though.
Written by David Meyer, Contributor

Google has released J2ObjC, a tool to make it easier for developers to write a common back-end for an app that can then be deployed across iOS, Android and the web.

The open-source tool, which automatically converts Java source code into the Objective-C language that is used in native iPhone and iPad apps, was announced in a blog post on Friday. The J2ObjC project page explains that it is "currently between alpha and beta quality", and versioned at 0.5 to reflect its readiness.

The command-line tool does not tackle the user interface for apps — in the case of iOS apps, the UI still needs to be written using Objective-C or Objective-C++.

"J2ObjC enables Java code to be part of an iOS application's build, as no editing of the generated files is necessary," Google engineer Tom Ball said in the blog post. "The goal is to write an application's non-UI code (such as data access, or application logic) in Java, which can then be shared by Android apps, web apps (using GWT), and iOS."

Ball explained that J2ObjC supported Java 6 and "most of its runtime features that are required by client-side application developers, including exceptions, inner and anonymous classes, generic types, threads and reflection", as well as JUnit test translation and execution.

The project page noted that some Google projects already relied on J2ObjC, but it was still buggy — partly because "every Java developer has a slightly different way of using Java".

Developers wanting to use the tool will need a Mac OS X system with Xcode 4 or higher, Java for OS X and Apache Maven.

Editorial standards