Google has authored J2ObjC, an open-source tool that can convert all the non-UI bits of Java code into Objective-C source code for use in iOS apps. It's not the first translator of this type we've ever seen, but coming from Google makes us have a serious look at this one. 

Put away your fanboy hats for a moment, and stop caring which OS has more market share or which OEM sold the most phones last quarter. Mobile will be is the next frontier of tech -- especially the Internet. Google building a robust and fully working tool to convert code for things like data access and program logic from Java to Obj-C is a big deal. This helps developers code once and port things to another platform with an automated tool, saving time and money. 

Google has stated that several of their own products are using this (no, they don't give specifics) and that it's currently between alpha and beta quality. If you're a developer, hit the source link to see all the requirements and helpful tips to get you started. If you're not a developer, just know that things like this will make mobile applications and services better for everyone.

Via Google Open Source BlogJ2ObjC project page


Reader comments

Google develops tool to translate Java to iOS friendly Objective-C code


I thought Apple banned this type of thing several years ago when many companies were using cross-platform development tools?

Quoting Daring Fireball:

In the new version of the iPhone Developer Program License Agreement released by Apple today (and which developers must agree to before downloading the 4.0 SDK beta), section 3.3.1 now reads:

3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

You should re-read the title. This converts Java code to Objective-C. Does nothing with APIs. This will be a huge help in converting my Android app to iOS.

Most high-end Android games are coded in C/C++ using NDK, so iOS game way to Android is much shorter.... and does not need that software :p

What that's saying is that iOS apps need to be written in Objective-C, and can't use some tool within the app to translate. J2ObjC takes Java and translates it into Objective-C, which developers can then use for their apps. So this isn't against the rules.

It says (in plain english, I might add...):

" Applications must be originally written in Objective-C, C, C++, or JavaScript. "

So yeah, it IS against the rules.
However, I'm not sure that rule is in place anymore, as there were news articles that the DOJ was looking into it.

And how do you think code reviewers will notice that just having Objective-C, C, C++, or JavaScript code in there hands?

This doesn't look to be a Java-to-Objective-C API. If I understand this article correctly, this will truly convert the code from Java to Objective-C, producing Objective-C code files that one can put into XCode to use in iOS apps.

I could be very wrong about this though. If it is just an API, your statement is likely going to hold up.

it doesnt compile the code, it lays it out in packages that can be imported into xcode.

smart move for google. Appcelerator already does this for a fee. just more proof of the state of the developer community for android.

Google has to burn money to develop something to make it lucrative for developers to code in java first.

unfortunately, the applications will be restricted from some APIs, mapkit, gamekit, anything that requires hardware accelerated graphics except webGL

A for effort though

Ingenious. This way fewer developers will skip on Android and code only for iOS. Even better, there's a chance more apps will be written originally for Android and then ported to iOS, rather than the other way round.

This is what I love about Google....Apple sues the pants off Samsung based on patents that may or may not have been infringed upon with samsung's android offerings, and google says "hey apple, we're gonna make your developers' lives easier for them...that way you can use our apps easier". That's how a TRUE firmware developer operates...not like a 4 year old who just dropped his ice cream cone.


there...I said it :)

Well, this also creates a significant incentive of convenience to develop for Android first and then convert to iOS afterward. It definitely serves Google's interests and indicates that parity of app availability is still a big concern for Google.

I mean, it's still a cool move, but it's hardly friendly or altruistic.

This is ingenious for google. A short sighted company would develope a tool to conver iOS code to Android friendly code. Instead they developed a tool to convert code to their competitor's product. It sounds stupid at first, but think about what this really means.

Any significant app developer wants to develop for iOS and Android. This will allow some developers to develop for both in less time, but what system are they actually learning? Androids. This means that is the system they are really spending their time with. This means a better product for android and more developers who are experts.

Interesting, but that's like saying,"Google develops tool to translate Ebonics to iOS friendly Spanglish"

You should all be doing cross-platform mobile development and you should be using the right tool for the job, allowing for code reuse and NOT maintaining separate code bases (even if your non-UI code is automatically converted for you).

I made a short post about alternatives for writing cross-platform code here:

This is actually quite smart of Google. Instead of people just developing for iOS, they develop for Android and then convert their code, so it is iOS compatible. Genius!