Hanging on the telephone

Inside RoboVM


Some said it couldn’t be done. Others said it shouldn’t. But this developer is actively scaling out a future for Java in the iOS. Here‘s his story.

Bringing Java to the iOS is somewhat of a mobile holy grail. But there‘s one developer who wants to give it his all. In this interview, Peter Friese speaks to Niklas Therning, the man behind the RoboVM open-source project and co-founder of Trillian Mobile AB – the main contributor to the RoboVM project – which is aiming to make the Java iOS leap come true.

JAX: Can you tell us a little about yourself?

Niklas Therning: My name is Niklas Therning. I’m 36 years old and I live in Gothenburg, Sweden. I’ve always had an interest in computers and I have been programming since the early 90s when I got my Amiga 500. I have an MSc in computer engineering from Chalmers, Gothenburg. For the past 10 years I have been working in my own company doing contract work, mainly server side Java and web app development. I also co-founded the SpamDrain anti-spam service ( where I have been doing not only frontend and backend coding but also customer support and server administration. For the past 3 years or so I have been working on RoboVM, first as a side-project in my spare time and then full-time for the past 1.5 years roughly.

Who is working on RoboVM?

Mostly me only. There’s a small community around the project but except for testing (which is awesome!) it doesn’t contribute very much yet. I think this is normal for any young open-source project. It takes time to build a community that is more involved. I must admit that I could probably do more to facilitate for contributors, e.g. by writing proper documentation of the RoboVM internals.

How is it funded?

So far RoboVM has been funded by our company, SpamDrain AB. But since a few weeks back we’ve managed to secure some seed-funding. This should give us a needed boost and we will soon hire some more developers to work on the project.

How did you come up with the idea for RoboVM?

Back in 2010 we started to build iOS and Android apps for SpamDrain. We did look into the different cross-platform tools that were available at that time. We didn’t want to build an HTML5/JS/CSS app so that ruled out almost all of the tools. And since all of us had extensive Java knowledge and this being the native language on Android we would have preferred something based on Java. We didn’t find anything to our liking so we went with Xcode and Objective-C for the iOS app in the end. This made me start to think about how one could get Java running under iOS. Xamarin had already shown that it could be done for C# with MonoTouch so why shouldn’t it be possible for Java?

How does it relate to Xamarin?

RoboVM is very similar to Xamarin in the way it works except that they let you use C# and .NET technologies while RoboVM lets you use Java and other JVM languages and Java platform technologies and tools.

And how about XMLVM?

At a high level it’s quite similar to XMLVM in the way it takes Java bytecode and transforms it into machine code. Their process looks like bytecode->XML->C->machine code while ours is bytecode->Soot Jimple->LLVM IR->machine code. I haven’t really looked at it closer than that.

In comparison to Objective-C, Java is a much more verbose language Where do you see the sweet spots for RoboVM?

Before I answer this one I would like to know how you think Java is “much more verbose”? I don’t agree with that statement. Please prove me wrong. :-)

RoboVM is not limited to Java. In theory you could use any language that targets the JVM. Scala, Kotlin and Clojure are other JVM languages that are known to work with RoboVM and those fixes many of the shortcomings of the Java language.

The main use case for RoboVM as I see it is the possibilities to share code between Android and iOS apps and for Java developers to reuse their skills, not having to learn a new language and new tools.

Objective-C has a very distinctive method naming pattern that does not translate well to most other languages. How do you translate method names from Objective-C to Java? Do you write the mappings manually, or do you use an automated approach?

I use a semi-automated process. I have a tool that reads ObjC header files and a config file and spits out Java class files. The config file can contain things such as method rename rules and info on where a global function should end up (there’s no global scope in Java). Method names are changed slightly to look more natural to Java programmers and shortened (usually by cutting before the first : in the selector name).

Most apps that have been published on the app store seem to be games. Is this a sweet spot for RoboVM?

Not really. When I started working on RoboVM I thought that games would be the least likely type of apps to use it due mainly to the garbage collection and potential “stop the world” pauses. But then the libgdx community showed a great interest in the project and I started to help them out to get a working RoboVM/iOS backend. Using libgdx one can now use a single code base to write games for Android, Blackberry, desktop, HTML5 and iOS. Even with 50+ libgdx based games already in the App Store I have heard very few comments about the GC being a problem. The libgdx community has been awesome by testing the code at a very early stage. I’m very grateful for their help.

What are your plans for IDE integrations and other developer tooling? Currently, you have an Eclipse integration, but people have been asking for IntelliJ integrations.

IntelliJ integration is the most commented issue on our Github page. At some point we will have to look into it if no one in the community jumps in. We already provide Maven integration and people in the community have done Gradle, sbt and Leiningen plugins. The JavaFX community and Oracle have done Eclipse and Netbeans JavaFX plugins that facilitate building JavaFX apps for iOS.

In the future we will have to provide a debugger and JUnit integration. It would also be nice to have some kind of Interface Builder integration.

What is the roadmap for RoboVM?

The goal is the have a stable version (1.0) sometime late Q3 or early Q4. Apart from being reasonably bug free this should include completed and tested CocoaTouch bindings and have proper documentation. We will start to offer some kind of commercial licenses around the project similar to what Xamarin does with the big difference that RoboVM has a fully useable open-source core which you can use to develop apps without any limitations.

Niklas Therning is the founder of the RoboVM open-source project and co-founder of Trillian Mobile AB – the main contributor to the RoboVM project. He has made it his mission to bring Java to iOS and do it properly. Before starting RoboVM Niklas co-founded the SpamDrain anti-spam service and worked as a contractor, mostly doing Java EE and web app development. Niklas holds a Master of Science degree in Computer Engineering from Chalmers University of Technology, Gothenburg, Sweden.

Inline Feedbacks
View all comments