iPhoneJava Version 0.2.0 is here !
We are proud to announce the second release of the iPhoneJava project. This release contains a reworked event system which resembles the GWT event system and is much easier to use. Totalling nearly 500 classes, it provides almost complete set of Java wrappers for the Titanium APIs. It is also updated to the latest code from Titanium, and shall support most of the new APIs in Titanium Mobile 1.8.0 which should come out recently.
The focus in this release is the new event system. We are now starting to work on the next major release, 0.3.0, which should contain experimental support for GWT-hosted mode. For those who are not familiar with it, the GWT hosted mode provides a runtime bridge between the Java Virtual Machine (JVM) and the Titanium platform. This bridge allows you to debug the executed code using the JVM's debugger directly from your favorite IDE. Another advantage of the GWT-hosted mode is that the code does not need to be recompiled upon every change - a huge time-saver considering that today you have to compile the Java code using GWT, then the generated Javascript code using the Titanium compiler. We will explain more about the GWT-hosted mode in an upcoming post.
Getting the new release
The new release is now available from maven central. You can include it in your project's maven build by adding the following dependency to your project's pom.xml file:
<dependency> <groupId>org.urish.gwt-titanium</groupId> <artifactId>gwt-titanium</artifactId> <version>0.2.0</version> </dependency> |
Or you can download the JAR file directly from the repository:
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.