Google Translates Java to Objective-C With J2ObjC Tool - Application Development - News & Reviews - eWeek.com | eWeek

Google Translates Java to Objective-C With J2ObjC Tool

Verfasst von
Darryl K. Taft
Darryl K. Taft
Sep 18, 2012
2 minute read
eWeek Inhalte und Produktempfehlungen sind redaktionell unabhängig. Wir können Geld verdienen, wenn Sie auf Links zu unseren Partnern klicken. Mehr erfahren

Google has announced the release of J2ObjC, an open-source command-line tool that translates Java code to Objective-C for the iOS platform so that Java developers can more easily build apps for the iPhone and iPad.

The goal of the J2ObjC tool is to enable developers 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, the Google Web Toolkit) and iOS, said Google engineer Tom Ball in a recent post on the Google Open Source Blog.

“J2ObjC enables Java code to be part of an iOS application’s build, as no editing of the generated files is necessary,” Ball said. “J2ObjC is not a Java emulator, but instead converts Java classes to Objective-C classes that directly use the iOS Foundation Framework.”

The new Google tool 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. And J2ObjC can be used with most build tools, including Xcode and Make, Ball said.

According to the J2ObjC project page, the tool is currently between alpha and beta quality. However, several Google projects rely on it, though when new projects first start working with it they usually find new bugs to be fixed, Google said. As nearly every Java developer has a slightly different way of using Java, the tool has not translated all possible paths yet. It is released as J2ObjC version 0.5. Developers must use the tool on a Mac OS X system, with Xcode 4 or higher, Java for OS X and Apache Maven.

J2ObjC does not provide any sort of platform-independent UI toolkit, nor are there any plans to do so in the future, Google said. iOS UI code needs to be written in Objective-C or Objective-C++ using Apple’s iOS SDK, just as Android UIs need to be written using Android’s API and Web app UIs using GWT or other tools.

With a debate raging over whether to develop native, Web or hybrid apps for mobile platforms, Google’s J2ObjC tool gives developers another choice for building apps for the popular iOS platform. Facebook CEO Mark Zuckerberg recently noted that one of Facebook’s biggest strategic mistakes was to base its mobile app development strategy on HTML5 rather than going native.

Nat Friedman, CEO of Xamarin, a maker of tools for creating fully native apps with device-specific experiences, said, “Two years ago you might choose to do an iOS app as a first choice because the iPhone was the leading platform, but now with Android there’s a challenge to that. And developers need tools to support building apps for these platforms.” Xamarin’s tools do that for C# developers, and now Java developers can use Google’s J2ObjC.

eWeek Logo

eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site's focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

Eigentum von TechnologyAdvice. © 2026 TechnologyAdvice. Alle Rechte vorbehalten

Werbetreibenden-Offenlegung: Einige der auf dieser Website erscheinenden Produkte stammen von Unternehmen, von denen TechnologyAdvice eine Vergütung erhält. Diese Vergütung kann beeinflussen, wie und wo Produkte auf dieser Website erscheinen, einschließlich beispielsweise der Reihenfolge, in der sie erscheinen. TechnologyAdvice schließt nicht alle Unternehmen oder alle auf dem Marktplatz verfügbaren Produkttypen ein.