How To Install, Compile, Run Java On iPhone

By Angsuman Chakraborty, Gaea News Network
Tuesday, June 10, 2008

iPhone doesn’t natively support Java / J2ME. However as a J2ME developer there are two good ways to develop iPhone applications using Java / J2ME. Read below for details and also to know how you can upload, compile and run Java applications on iPhone.

alcheMo-for-iPhone - Automated J2ME to iPhone porting solution

No manual adjustments to the translated source code is required. Compiled using the standard Xcode toolchain and linked with alcheMo’s optimized run-time library, a native iPhone application is produced.

Garbage collection and automatic memory management is one of the strengths of the J2ME environment. Unlike on Macintosh OS X, Objective C on iPhone does not support garbage collection. By incorporating an advanced garbage collector, alcheMo eliminates the need for manual memory management. Whole classes of common programming errors such as dangling pointers are thus prevented.

The initial version of alcheMo for iPhone is optimized for mobile games.

The bad news is that their beta program has closed on April 24th, while they are preparing for commercial release. alcheMo for iPhone has backing from Sun Microsystem.

BTW: During Java One 2008, Sun officials repeatedly mentioned that they successfully ran Java on iPhone but are thwarted only by Apple’s licensing restrictions in publicly announcing it. alcheMo circumvents Apple’s licensing restrictions with their language translator.

Then you need to have the installer app on iPhone. Installer.app is a UIKit based package manager for the iPhone. It works by downloading packages over WiFi (wireless networking) or EDGE. It supports installing, updating and uninstalling applications from multiple sources.

Now go to Installer and install Mobile Terminal and Cydia Installer. Restart iPhone.

Run Cydia Installer and go to Java section and select iPhone/Java which will install the virtual machine, libraries etc. Then install Jikes (java compiler). Now restart iPhone again.

That’s it, you are done.

How to load, compile & run Java applications on iPhone

First install Java on iPhone following instructions in the section above before reading this.

You can upload Java files to iPhone using iPhone Browser.
Run Terminal (installed above) and use java (jikes) compiler to compiler your program. For example:jikes -cp /usr/lib/rt.jar MyFirstJavaProgramForIPhone.java

You can run the class file as usual:java MyFirstJavaProgramForIPhone

Java on iPhone - Concluding thoughts

The second method (using jailbraked iPhone) suffers from three major problems.
1. To use your Java applications, your user will also have to jailbrake their iPhone. As such its usage will be limited to highly technical people who are not afraid of tinkering with their costly iPhone and potentially even risk damaging it permanently!

2. While it may be fine for experimenting, the legality is dubious. You may run into problem with Apple for selling or even distributing such applications.

3. The jailbraked versions of iPhone may not be compatible with future firmware updates, and Apple will try their best to disable them at every opportunity and had done so in the past.

All of the above makes method 2 unsuitable for commercial use.

Commercial J2ME developers have to wait for commercial release of alcheMo-for-iPhone. Innaworks is well known for porting standards compliant J2ME to BREW mobile platform. I expect their solution to be ready in 2-3 months time. If you do not have the time then download Apple’s iPhone SDK and start coding in Objective C.
BTW: Make sure you read the iPhone SDK agreement carefully before you invest huge sums in iPhone development.

Apple A2141 is real headach for me help me for
1.Im getting end call after 5 min while I am speaking on my 3G apple.
2. how to get set with the GPRS cause when I send SMS for Activation it dose not reach the server of BSNL-India.
3. Phone addres nos. are just 10 to 12 nos. rest not shown as on SIM card.. help. 9422396488

Running Java apps on iPhone seems to have stimulated some brains ^^.
Other legal solutions exist now!
Whereas AlcheMo addresses J2ME only, iSpectrum by FlexyCore provides you with a full Java 1.5 compliant solution along with an Eclipse plugin that allows you develop native iPhone applications.
Check it out at http://www.flexycore.com

Trying to put a .jar file on my jailbroken IPhone. File is supposed to unpack and run itself once it is loaded on a java enabled phone. I have java on Iphone through Cydia, now need to move jar file and have it operate. please help.

Sir,
I have bought a iphone copy m003/ java/32GB/3.4″ touch screen/.
I want to install java supported word/ pdf in memory.
have you any software CD to install it .please send me price and shpping in India.
Thanking you
vinod/
contact No- 09977154909

I got a compass iphone from china MT6235 model A2141 but when i go to internet and open video it will go to another screen written on top is Insufficient…(after the words the others are hidden)and below it state Application
JAVA (4097K) and below shows

BACK STOP

If i press back,it will stuck at a page to load internet
If i press STOP,all Java application will close including my Opera mini and can only be used after i reboot the Phone….Also i cannot save files-the error is no read permission-(what is that)