First Step

Posted on Saturday, May 31st, 2008 at 10:28 am

Ok, 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:

  1. 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.
  2. Then, to make your iPhone usefule, please install OpenSSH, and Term-vt100 from the Installer.app
  3. 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.
  4. Open Cydia and reload the package list. After that, please install the following packages:
    1. JamVM : this is the Java VM for iPhone
    2. GNU Classpath : the java class library
    3. JocStrap : Java/Objective-C binder/bridge
    4. UICaboodle : iPhone UI library and launcher, you need this for GUI application
    5. Java SQLite : JDBC Driver for SQLite, the database engine used by iPhone
    6. Jikes : Java compiler, yeah, you can compile your Java code “in” your iPhone.
    7. iPhone-Java : an example applications for Java/iPhone.

    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.

  5. 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.

  6. Then, you can run your application in the usual way, i.e, java -cp . Hello

If you want to see some picture, look at this (link from http://homepage.mac.com/robert.lougher/).

    You can leave a response, or trackback from your own site.

    One Response to “First Step”

    1. shopping cart says:

      Hi

      I think it is a best way of teaching a program.

    Leave a Reply