The following article explains how can you get a lightweight, dynamic OSGi based application server to run on an android phone.
Firstly you’ll needed a phone – fortunately I have an old (2.5 years old, which is ancient for mobile phones these days) HTC manufactured Nexus One running stock Android Gingerbread (2.3.3). This can work on other android phones but I had this one lying spare in my study and so I can use it without fear of breaking my current mobile if things go wrong. The CPU is a snapdragon processor running upto 1ghz and has 512MB of RAM – which sounds plenty but it is an ARM processor which doesn’t have out of order execution, which means it’s nowhere near as fast as a modern laptop or desktop processor.
Next I needed a way of running Java on my phone – Android’s code may look like Java but the dalvik virtual machine isn’t “full-on” Java and runs in a sandbox environment that would need me to change the application server code to run in the android app sandbox environment, which I won’t do. These issues mean I cannot run the Liberty profile natively on Android. I decided to look for a flavor of Linux to install on my phone which I can then run a true Java VM on. I happened upon a fantastic blog guide – it has full instructions and a step-by-step guide on how to install Ubuntu onto a Nexus One (as well as other android devices). The instructions will work for other android phones too, but it depends on if they support loop devices. The best part with this guide is it lets me run Ubuntu and Android at the same time – so I can have android managing the wifi/3G network connectivity which Ubuntu can use.
Following the instructions on how to get Ubuntu on my nexus one I managed to have Ubuntu up and running in a couple of hours. Now I have the environment I needed to install Java before I can get my application server installed – this was as easy as running “apt-get install openjdk-6-jre” in my Ubuntu shell and it was installed.
Now I had Java available in Ubuntu it was time to install my application server. I downloaded a zip of the Liberty profile application server from the WASdev download page and extracted it into a suitable place in my Ubuntu install (I chose /opt/wlp but you could unzip it anywhere). This install process was really easy as it was a simple unzip.