First Step
Posted on Saturday, May 31st, 2008 at 10:28 amOk, basically, now we’ve only one choice and we know that it’s not from the Sun. Basically it’s the work of the man who ports JamVM, GNU Classpath and Java/ObjC binding to iPhone/iPod Touch. Thank you, thank you. So, following are the steps to make your iPhone/iPod Touch Javanized:
- As the first step, of course, you need to jailbreak your iPhone first (I’ll call it only iPhone from here, but you know, it’s including iPod Touch as well). The best and easiest way is by using Ziphone.
- Then, to make your iPhone usefule, please install OpenSSH, and Term-vt100 from the Installer.app
- Install Cydia application manager (actually, a Debian APT GUI front-end, so if you’re Debian or Ubuntu Linux users, you’re at home with all that apt-* command), to do this, in Insaller.app, add http://apptapp.saurik.com to the source list, then refresh. Then, install “Cydia Installer” and after that, quit Installer.app.
- Open Cydia and reload the package list. After that, please install the following packages:
- JamVM : this is the Java VM for iPhone
- GNU Classpath : the java class library
- JocStrap : Java/Objective-C binder/bridge
- UICaboodle : iPhone UI library and launcher, you need this for GUI application
- Java SQLite : JDBC Driver for SQLite, the database engine used by iPhone
- Jikes : Java compiler, yeah, you can compile your Java code “in” your iPhone.
- iPhone-Java : an example applications for Java/iPhone.
- Then, you can start the terminal, fire up the vim and start writing your first Hello World in iPhone. I put an example below, well, just in case
Hello.java
public class Hello {
public static void main(String[] args)
{
System.out.println("Hello World.");
}
}Then, compile it using this command
$ jikes -bootclasspath /usr/share/classpath/glibj.zip Hello.java
It’s a bit ugly because you’ve to tell jikes where the class library is. Anyway, you can write a shell script call “javac” like this,#!/bin/sh
jikes -bootclasspath /usr/share/classpath/glibj.zip "$@"Will handle our business just fine.
- Then, you can run your application in the usual way, i.e, java -cp . Hello
If you’re like me, a unix geek, you’ll need the VIM, sorry Emacs, you’ve no place on iPhone 😀 . Also, I recommend to install wget, cvs (or svn), Bash, bzip2, gzip, zip, top, less, lynx, make and another everyday unix commands. You can install these program by using Cydia GUI, or apt/dpkg tools in command shell.
If you want to see some picture, look at this (link from http://homepage.mac.com/robert.lougher/).
Hi
I think it is a best way of teaching a program.