RoboVM brings Java 8 programmers to iOS

RoboVM brings Java 8 programmers to iOS

[51CTO translation] RoboVM allows developers to use lambdas and defaults, while providing full access to hardware and native iOS APIs.

Java's poor performance on the iOS platform has always been a headache for Java developers. Although Java developers can use various roundabout ways to run their own applications on such devices, Apple's development restrictions on Java on its iOS smartphones and tablets are still a headache. In order to solve this long-standing problem, RoboVM, as a leader in similar technical solutions, was officially unveiled at the JavaOne Technology Conference held recently in San Francisco.

RoboVM can convert Java bytecode into native ARM or x86 code, and also includes a channel for connecting Java and Objective-C code. For now, RoboVM is mainly used in the field of game applications, but the project founder Niklas Therning expects that after the release of version 1.0 in November or December this year, its scope of application will be extended to more application types. In a recent email interview, he answered various questions raised by reporters about RoboVM.

Reporter: What are the limitations of running Java code on iOS?

Therning: Since late 2010, Apple has allowed developers to embed interpreters in their apps, and these apps also embed all the scripts needed to run, which is a significant reduction in iOS restrictions on Java. But even with the original restrictions, RoboVM can still work well because it does not need to launch other executables, does not need to embed any interpreters, and does not translate any code at runtime. With RoboVM, all bytecode is pre-compiled to machine code on the developer's device, and the final application is built very similarly to native applications built with Xcode and Objective-C/Swift - in other words, it does not have a distinct Java application style... We have proven that Java and other JVM languages ​​can work well on the iOS platform with RoboVM without violating Apple's iOS Developer Program License Agreement. I really don't see anything contrary to this in Apple's guidance.

Reporter: Does the RoboVM solution contain any revolutionary technological achievements? If so, can you talk about it in detail?

Therning: RoboVM is the only solution that can help developers use all the new language features in Java 8, including lambdas and default methods. RoboVM is unique in that it provides full access to hardware and native iOS APIs through a set of Java to Objective-C bindings. With these bindings, you can use Java to build applications that you can do with Apple's Xcode and Objective-C/Swift.

Reporter: Does the RoboVM solution include JavaFX?

Therning: RoboVM allows developers to build cross-platform applications using the JavaFX GUI framework with 100% code reuse between platforms. We are currently working on LodgOn to enable JavaFX to work on both iOS and Android mobile devices, and the results are very exciting. However, it is important to emphasize that RoboVM does not depend on JavaFX to work. If you prefer to use native UI components for application development, you can choose this alternative. In the keynote of the JavaOne 2014 conference, we demonstrated how technicians can develop Android and iOS applications with native UI and still maintain a high code reuse rate between the two platforms.

Reporter: So how does RoboVM differentiate itself from projects like Codename One? According to the latter's official website, it claims to be able to "translate Java bytecode into native C/Objective-C code and leverage Xcode compilation mechanisms to achieve seamless development of mobile applications."

Therning: In RoboVM, we chose a slightly different approach for our precompilation mechanism. Instead of Codename One translating Java code into C/Objective-C, we chose to leverage the inherent strengths of the LLVM project toolchain. You can think of RoboVM as a front-end for LLVM that translates Java bytecode into LLVM bitcode, which is then optimized and translated into machine code using the LLVM back-end. LLVM supports all different types of CPU architectures and operating system options; in theory, it should be enough for RoboVM to work with all of them.

But for now, we are still focusing on iOS. By using LLVM bitcode instead of C/Objective-C as a transitional stage - different from Codename One - we can have more effective control over the final machine code and achieve actual results in code compactness and running speed far beyond C/Objective-C.

Original link: RoboVM beckons Java 8 programmers to iOS

Nuka-Cola Translation

<<:  What did Cook say to Apple China employees before accepting media interviews?

>>:  Responsive Interaction in Material Design

Recommend

AARRR model’s new customer acquisition methodology

After two weeks of sorting and reviewing material...

How to advertise in Douyin?

1. Traffic dividend channels Any place with traff...

Double 11 is marketing, not promotion

Tmall Double 11 just ended, generating sales of 4...

UI interface drop-down menu complete design guide

Editor's note: This article is written by sen...

How to promote products to gain more users and traffic?

An old friend of mine from the media industry sta...

Tech Neo Technology Salon 15th Special Report - How CDN Makes the Network Smarter

【51CTO.com original article】 [51CTO original arti...

Apple's new iPhone production this year is 65 million, the lowest in four years

At 1 a.m. Beijing time on September 11, Apple wil...

iOS view, exploration of animation rendering mechanism

When developing a terminal, the first thing to co...

Jack Ma: Fortunately, I started my business 20 years ago

[[152236]] The annual Alibaba Cloud Conference at...