Core Java on iPhone
Looks like things are going good on porting the Java VM on to iPhone. The fact is that iPhone is very well poised to run Java applications better than any other phone. Jay Freeman has been successful in porting the JamVM on to iPhone. JamVM is JSE 1.5 compatible. The core java classes has been ported already and Graphics and Media frameworks are being actively investigated. The current port is not optimised for the iPhone CPU. So expect it to run tad bit slow.
The iPhone offers a built in relational database in the form of SQLite. This is used to store information by the iPhone’s Notes application. Efforts are under way to offer a JDBC driver for this database too. The JamVM itself is pretty small - around 150k and uses the GNU Classpath libraries(9 MB). Compiling java source on iPhone is also possible now with Jikes ( upto jdk 1.4) or by using the Eclipse java compiler.
Please checkout the Java on iPhone development page for more details.
stumble
digg
tag this
December 18th, 2007 at 12:39 am
JamVM is JSE 1.5 compatible. Not true.. the pages you reference make no claim of JavaSE Compatibility, and say over and over that they’ve ported only a subset of the java.* classes so therefore it cannot be Java Compatible.
December 18th, 2007 at 3:12 am
Thanks David. I have made the corrections. Jay’s project page though states about 1.5 core classes. I need to verify the version compatibility more further.
December 18th, 2007 at 3:22 am
The port apparently IS capable of running JSE 1.5 command line applications.
December 18th, 2007 at 4:26 am
Thank you for your correction. Perhaps my vision on this is blinded a little by working inside the Java SE team. To us the word ‘Compatible’ when said like ‘Java Compatible’ means that it has passed the testing which allows for certification.. namely, the Java TCK (JCK). Doing some adhoc testing like “it runs a few commands” is like saying “this code ‘works’ for some definition of ‘works’”. I own an iPod Touch and would love to have Java on the thing. But in my role as a Java SE team member I’m very interested in knowing that when something claims to be ‘Java’ that it really is ‘Java’.
December 18th, 2007 at 3:55 pm
so when will we java apps on iphone?
December 18th, 2007 at 5:23 pm
Please note that this is not J2ME. So your old games etc still wont work.
December 18th, 2007 at 10:17 pm
Regarding compatibility. It is using JamVM 1.5.0 with GNU Classpath 0.96.1.
JamVM 1.5.0 implements the publically available Java Virtual Machine Specification Second Edition, and the JNI specification, including additions up to JDK 1.5.
GNU Classpath 0.96.1 aims for 100% compatibility with JDK 1.5 but it isn’t complete. Its API compatibility is tested by Japitools, and the results are publically available:
Against JDK 1.4 (92.63%) :
http://www.kaffe.org/~stuart/j.....spath.html
Against JDK 1.5 (88.33%) :
http://www.kaffe.org/~stuart/j.....spath.html
However, neither JamVM or GNU Classpath has been tested against, let alone passed, the Java Compatibility Kit (JCK). This is required for certification and to be “Java Compatible”.
Having said that, Sun have not made the JCK available to open-source projects so it’s hardly surprising that they haven’t been tested against it.
With the release of OpenJDK, Sun have announced a new license for the JCK (OpenJDK Community TCK license):
http://www.infoq.com/news/2007/08/openjdk-jck
However, to qualify for access to the compatibility tests the project must be “substantially derived” from the OpenJDK itself. This means the JamVM/GNU Classpath combination would still not be able to be tested as both are clean-room implementations and are in no way derived from OpenJDK.
December 18th, 2007 at 10:46 pm
I should also add that in the absence of the JCK, the open-source community has been working on Mauve. This is a collaborative effort to write a free test suite for the Java™ class libraries :
http://sources.redhat.com/mauve/
JamVM and GNU Classpath are regularly ran against Mauve. The results can be found on comp.java.classpath.testresults :
http://news.gmane.org/gmane.co.....estresults
Or directly from GNU Classpath’s official autobuilder and regression tester:
http://builder.classpath.org/
December 18th, 2007 at 11:17 pm
Yes, Robert, I agree the situation as it stands is not ideal.
December 22nd, 2007 at 8:29 am
The answer to when you can run Java applications on your iPhone is immediately, and for the last week or two ;P.
If you add the repository http://apptapp.saurik.com/ to Installer.app and install a bunch of stuff you will be able to write _graphical_ applications for your iPhone in either Java or JavaScript (thanks to Rhino, and some extra work I put in to JocStrap).
There are also a couple example applications in there: HelloJava and HelloScript. Both include their source code so you can see how they work.
If anyone needs help, send me an e-mail; my contact info is on my website. I also hang out on #iphone on irc.saurik.com, if anyone wants to come and ask questions.
There will probably be a separate website soon for my JocStrap project, and some tutorials of how to write applications now that development isn’t so hectic ;P.
December 22nd, 2007 at 8:37 am
Oh, just to be more clear: you can write “native” iPhone applications in Java/JavaScript, as in, that work exactly like built-in applications and operate on the same library. This is due to my JocStrap library, that connects Java to Objective-C.
If anyone needs more support than what JocStrap currently provides (which is a number of frameworks including WebKit, Celestial, and UIKit), I’d be happy to either activate it or fix it. ;P