J2ObjC: A Java to iOS Objective-C translator
Posted:
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


Wow... This tool might very well become the default way of publishing to iOS for jMonkeyEngine. Thanks so much! You'll probably be hearing more from us.
ReplyDeleteBy the way, a map of Java library stuff J2ObjC recognizes would be really handy.
Why would they do that? Are they trying to get developers to write apps for Android first?
ReplyDeleteBingo !!
DeleteYeah! And Java is a more friendly language than Objective-C...
DeleteI had a boss that used to call objective-c "Klingon"... LOL
My jaw dropped, gunna try this out tonight, great job guys!
ReplyDeleteWow, same draw dropping response as Walter,
ReplyDeleteI wonder if this works with cocos2d off the bat.
Made Android→ Blackberry App Conversion Tool please
ReplyDeleteWhere is manual how to use it?
ReplyDeleteI put path of sources(-sourcepath) and -d where to translate and get
Translated 0 files: 0 errors, 0 warnings
Develop PDF to android app apk converter and retribute free please. The converter have to include android ebook app apk simulator.
ReplyDeleteThat is awesome! I am testing right now!
ReplyDeleteWhere has the j2ObjC link gone?
ReplyDeletePlease update it as the link is now unknown by Google.
Thank you
I've just started using J2ObjC in a new project and I have to say that it's a wonderfull tool as long as you use it right.
ReplyDeleteJ2ObjC can't convert android related apis and works only on java code with no other dependency than the java API.
So, to use it correctly, you have to follow a very strict MVC pattern (not a bad thing).
Also, you have to encapsulate native functionnality into classes that must be rewriten for the two platforms. In my app, I've got to rewrite a wrapper for SQLite (because android and iOS's SQLite arn't convertible by J2ObjC) and a wrapper for making HTTP REST call on both systems.
Anyway, definitely a good tool once you get used to it.
I've published a series of blog post (in french, sorry) about getting up and running with J2ObjC here. Maybe it can help some of you out there.
If you check it out and find some quirks (or not usefull at all), please let me know.
Great article with detailed information. I am creating a repository of great articles and will add this link there. Thanks.
ReplyDelete