opensource.google.com

Menu

J2ObjC: A Java to iOS Objective-C translator

Thursday, September 13, 2012


We are proud to announce the open source release of J2ObjC, a Google-authored translator that converts Java source code into Objective-C source for iPhone/iPad applications.

J2ObjC enables Java code to be part of an iOS application's build, as no editing of the generated files is necessary. 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.
J2ObjC is not a Java emulator, but instead converts Java classes to Objective-C classes that directly use the iOS Foundation Framework.  It supports the full Java 6 language 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. JUnit test translation and execution is also supported.  J2ObjC can be used with most build tools, including Xcode and Make.

You can go to the J2ObjC project page for instructions on how to use the tool, check out the source code and view the list of reported issues.  The site also has detailed design docs for anyone interested in how the translator works.

By Tom Ball, Google Engineer, Mountain View

.