Gosling: New Java proposal could ease ports to iOS

Could statically linked JNI open the way to Java programming for iOS?

Might Oracle's new statically linked JNI (Java Native Interface) proposal help Java developers build for Apple's popular iOS mobile platform? The founder of Java, James Gosling, sees it as a possibility.

The JNI proposal, known as JEP (JDK Enhancement Proposal) 178 was created last month as an addition to the OpenJDK open source Java platform and updated this past Friday. It is intended to modify the Java SE specification and the JDK (Java Development Kit) to enable developers to package a Java runtime, native application code, and Java application code together into a single binary that does not require the use of shared libraries.

More about Java Native Interface

Get a tutorial introduction to JNI, then learn about two tools that build on top of JNI to simplify native access, Jace and Java Native Access.

Want more Java enterprise news? Get the Enterprise Java newsletter delivered to your inbox.

Gosling views the proposal as potentially a way to improve accommodations for Java on iOS. Apple does not permit the JVM to run on iOS devices, but workarounds like the Java and HTML5 development framework Oracle ADF (Application Development Framework) Mobile have enabled Java developers to leverage their skills to build for iOS.

"Java has been on iOS for quite a while" via Oracle ADF Mobile, Gosling notes. "The catch is that to deal with an arcane nit in the Apple terms of service, the JIT code generator has to be turned off. I'm not at Oracle, and I'm not involved, but I'd be willing to wager that JEP 178 can be used as a part of complying with the Apple TOS (terms of service) without turning off code generation."

Oracle's proposal would require no changes to existing Java code in order to use a static native library as opposed to a dynamic native library. In addition, a Java application would be allowed to use a combination of static and dynamic native libraries, although static libraries have to be in memory prior to any attempt to use them, the proposal reads. "JEP 178 is a major requirement for 'Java on iOS' because Apple does not allow [dynamic loading of] native libraries," says Tobias Bley, who participates on an OpenJDK mailing list. "So an iOS app has to be one binary. So we need to build a big binary including a JVM and Java code in one file. Currently the JVM uses dynamic libraries but needs static libraries on iOS."

Oracle declined to comment about JEP 178. For most developers, JEP 178 is irrelevant, Gosling said. "But for people building embedded apps or with unusual packaging, it can be a very big deal," he said. "The embedded Java world has been remarkably healthy and particularly the world of folks using the full-up JDK implementation. Embedded devices aren't memory-constrained anymore, so trimmed down versions like Java ME (Micro Edition) aren't required. But to stop using Java ME and switch to the full JDK, the JDK needs to be able to deal with the packaging environment."

The JNI proposal could serve to boost Java on iOS as well as promote use of the full JDK on embedded devices at the expense of Java ME. While Java has drawn much unwanted attention lately due to its security issues, Oracle nonetheless continues to expand Java's horizons. Better linkage between Java and iOS could open up new opportunities for both developers and iPhone and iPad users.

This story, "Gosling: New Java proposal could ease ports to iOS ," was originally published at InfoWorld.com. Get the first word on what the important tech news really means with theInfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

This story, "Gosling: New Java proposal could ease ports to iOS" was originally published by InfoWorld.

View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies