iPhone Java Create iPhone/iPad Applications using Java

10Jul/111

iPhone Java project kicks off!

iPhone Java is a new initiative enabling developers to create iPhone applications using the Java programming language. The project takes advantage of existing technologies (namely Google Web Toolkit and Appcelerator's Titanium) in order to enable the creation of native-looking iPhone applications written entirely in Java.

Underlaying Technologies

The Google Web Toolkit (GWT) technology enables seamless and effective compilation of java code into javascript code, and is developed by google. The framework is originially targeted at web developers, but can also be extended to support additional scenarios.

The Appcelerator Titanium SDK is a framework which enables creating native-looking mobile applications for various mobile platforms, including the iOS and Android platforms. The application code is written in javascript, then packaged with a native javascript runtime engine and a set of modules providing access to most of the native device functionality.

iPhone Java (code-named 'gwt-titanium') is a set of Java bindings for the Titanium APIs, along with a custom GWT linker, enabling the compilation of java code into a javascript equivalent that can run directly under the Titanium platform.

Project Status

There is no official release yet, but a significant amount of code has already been comitted to our github repository. There is currently very little documentation, one working 'hello-world' example, initial (non-working) code base for a Kitchen Sink example, and comprehensive javadocs for the API bindings based on Titanium SDK documentation. The code for the project is released under the Apache License, Version 2.0.

'Hello World' Example

The hello world example provides a quick proof of concept and serves as a starting point for new projects. An upcoming blog post will cover the 'Hello World' example in detail, including some screenshots.

Obtaining & Building

Get a fresh copy of the latest source code from github. If you are not familiar with github, you can download a zipped copy by clicking the "Downloads" button on the top-right side of the github page, then you will get a dialog window offering you to download the source code directly.

Next, place the files "gwt-user.jar" and "gwt-dev.jar" from GWT 2.2 distribution under the 'lib' directory. Newer version of GWT will also work. The latest GWT sdk (at the time of writing) can be downloaded here: http://google-web-toolkit.googlecode.com/files/gwt-2.3.0.zip.

Finally, run the "build.xml" file using the ANT build system. This will create a file named "gwt-titanium.jar" under the 'build' directory, which is the GWT module you use for creating iOS applications in Java.

Building 'Hello World'

Simlpy run the "build.xml" ant file in the 'examples/hello-world' directory. This will result in a file called "HelloWorld.js" under 'examples/hello-world/build', which is the javascript compiled version of the example.

Running 'Hello World'

You will need a Mac device for running the 'Hello World' example on your iOS device. If you only have a windows machine, you can still use the framework and utilize the Titanium support for android in order to run the example inside the Android emulator or on a real Android-based device. You will also need the Appcelerator Titanium SDK installed (free, under the Apache 2 License).

Create a new mobile project inside the Titanium Studio IDE. After you have created the project, simply copy and paste all the content from the HelloWorld.js you built in the previous step to 'Resources/app.js' in the newly created project. Run the new application from within the Titanium Studio and you are ready to go!

If you need assistance in installing the Titanium SDK and creating a project, check out Appcelerator's Help Center.

Credits

The iPhone Java project is lead by Uri Shaked.

I would also like to credit the gwt-node project, which provided a great start for creating the custom GWT linker.

Final Words

The gwt-titanium project is just in the beginning. I would love to hear your thoughts and ideas and see how far we can go with this project.

 

Comments (1) Trackbacks (0)
  1. Great step towards innovation , best of luck !!


Leave a comment

(required)

No trackbacks yet.