Platinum Partner
java,mobile,iphone,android,blackberry,windowsphone

Codename One - Making WORA Real Again For Mobile Devices

The iPhone was the first major phone to launch without Java, changing the landscape dominated by J2ME into a reality with a different kind of fragmentation. The open source Codename One project unifies the mobile platforms (iPhone, Android, Blackberry, Windows Phone 7 etc.) into a single API and tool stack based on Java. It allows developers to write code in Java and get native applications that can be installed on all mobile phones legally.


Codename One binds together years of work from multiple projects in the Java space to create a single coherent environment while allowing you to leverage the full power of Java tools directly from NetBeans/Eclipse. The API is Swing like with many improvements (proper styles/theming, painters, animations etc.) & yet allows full access to the underlying native device code. A standard GUI builder, simulator & IDE plugins are included and are all open source.
Seeing is believing so lets jump right to the code... After installing the Codename One Plugin (available for Eclipse/NetBeans) we now have a new Codename One project entry.
 
 


 Codename One on the iPhone simulatorCodename One Android SimulatorCodename One Blackberry Torch Simulator


 
 
We can create and run a new GUI builder hello world or non-GUI builder project in 30 seconds just by following the Wizard.

There is an active developer community forming around Codename One which can help you get started with the tool and answer the obvious questions.

Where's the catch?

There are several things you need to know:
1. For maximum compatibility Codename One currently limits you to CLDC 1.1 syntax of Java. You can remove this limitation (by changing the build.xml file) but you will forfeit RIM/J2ME compatibility in the process.
Even if these platforms aren't important to you we still wouldn't recommend doing this since you are more likely to stumble onto a Java SE feature that isn't supported by a target platform. In the future Codename One intends to slowly add additional API's and features from Java SE in a compatible and controlled manner.


2. Building for device requires sending the build to the server, this removes the need of owning a Mac for iOS builds or a Windows 7 machine for Windows Phone/Blackberry builds.
Since Codename One is open source you can build locally from the source repository but its a very complicated process.  
Using the build server is free for reasonable usage and we intend to keep it that way.


3. Currently you can't change the classpath. We intend to add a library mechanism which will allow 3rd parties to include "native" code in the library. You will need all your code in CLDC 1.1 source form, most of the API's you will need (XML/JSON parsers, UI etc.) are already included in Codename One.

 
4. Codename One is new and its a work in progress, manage your expectations accordingly. However, we are very fast with the fixes and due to the years invested in the open source projects underlying Codename One the infrastructure is very solid.
 
I will write more about what you can do with Codename One and how to accomplish it in a future post.
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}