The converter translates Java source code into Objective C code

Sep 14, 2012 17:31 GMT  ·  By

The mobile space is highly fragmented, yet there are only two big platforms you need to worry about, Android and iOS. As a developer, that doesn't sound so bad, but apps for the two platforms are quite different, if only because Android ones are written in Java and iOS one in Objective C, which Apple favors.

The two are fairly different and small app developers don't have the resources or the expertise to build apps for the two platforms at the same time and of the same quality.

Google has been looking at a solution and has come up with J2ObjC, which you can probably guess what it is, a converter from Java to Objective C.

"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," Google wrote.

The aim is simple, developers that already have a Java codebase can convert it into Objective C if they want to release on iOS and build from there.

Obviously, this is not going to work for UI code or anything API specific, but this still leaves a lot of code that can be easily converted, particularly for complex apps like games.

"J2ObjC is not a Java emulator, but instead converts Java classes to Objective-C classes that directly use the iOS Foundation Framework," Google added.

"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," it explained.

J2ObjC is also available for download here.