With this tutorial you will be able to install
Java
on the IPhone, compile and run simple
Java applications
using IPhone.
I decided to split this tutorial into two different ones. So here they are:
Have fun and leave comments.
Tutorial: install Java on the IPhone
This is a tutorial, that shows step by step how to install Java on the IPhone.
What we need is a working unlocked and jailbraked IPhone with Installer . I used latest firmware 1.1.4, unlocked, jailbreaked and customized by winpwn .
First of all I'd like to say we all want to use legal IPhones and operators. So everything written below is for testing purposes only . Hopefully this technology will be avaliable on all IPhones sold worldwide. You also might need to recover your IPhone, so make sure you backed up all your data. I personally did everything without any problems and needs to recover. Everything you do is your responsibility, etc...
So let's start, because it's worth it! It's just one evening and you will be able to create your personal Java application, compile and run it on the IPhone, and amaze all your friends .
There are two steps:
Step 1: Go to Installer and install Mobile Terminal and Cydia Installer.
- Go to Settings -> General -> Auto-Lock and set it to Never. This will avoid some troubles during installation.
- Run Installer. Repository for Terminal should be already there (BigBoss), because it is in latest Community Sources.
- Add repository http://apptapp.saurik.com for Cydia Installer and refresh
- Go to Install -> System
- Find Term-vt100 - Mibile Terminal App. I used version svn278. Install it.
- Go to System again and find Cydia Installer - The Future of the IPhone. I used version 1.0. Install it.
- Exit. Restart IPhone. Two icons for Terminal and Cydia should appear.
Here are some screenshots for Step1:
Step 2: Go to Cydia Installer and install Java.
- Run Cydia Installer.
- Go to Install - Java section. You will find many programms there.
- Select IPhone/Java. It will install most of the needed packages, which includes vm, libraries, etc.
- Click confirm and wait a little bit.
- Go to Java section again and install Jikes package (itwill be probably the only one left). Jikes is a compiler.
- Go to Installed Packages tab. Check that Classpath, IPhone/Java, JamVM, Jikes are installed. Several other packages will be there too (Java SQLite, JocStap, etc).
- Exit Cydia and restart IPhone. Congratulations!!! You're done installing Java.
That's it. The tutorial about using all this stuff is here
Tutorial: compile and run Java application on the IPhone
This is a tutorial, that shows step by step how to use installed
Java
on the IPhone. Just in case you do not have Java installed on your IPhone there is a
tutorial
how to do it.
What we need is a working jailbraked IPhone with Java Installed . I used latest firmware 1.1.4, unlocked, jailbreaked and customized by winpwn .
Step 1: Create simple Java application, compile and run.
- Create file Java4IPhone.java and put simple Java hello-world code there. I used the following code:
- Upload to IPhone. I used /tmp directory. For uploading I used IPhone Browser .
- Run Terminal.
- Use command java -fullversion or jamvm -fullversion to see if java is avaliable.
- Use command jikes to invoke java compiler.
- Go to /tmp directory, using command cd /tmp
- Compile. We need to specify classpath to basic java packages. If we do not do that, jikes will produce an error (see screenshot ). So use the following command: jikes Java4IPhone.java -cp /usr/lib/rt.jar
- After compiling Java4IPhone.class file should appear in the same directory. To run use command java Java4IPhone
- Take a look at the screenshots . Hopefully you'll have something similar.
Step 2: Have fun!