SYSTEM HALT

General Technology Blog

Java on iOS 4 (iPhone)

Recently I had done some research about Java VM running on iPhone devises. At the moment Apple does not support java application and from what Steve Jobs said, there is not plan in the future to do so. Lucky we can have Java VM on our iPhones.

In order to do this you will need of course to jailbreak you iPhone and install OpenSSH and APT-Strict application from Cydia, then SSH to your iPhone IP with username: root and password: alpine and trype to install java this commands:

1. apt-get update
2. apt-get upgrade
3. apt-get install jamvm jikes classpath iphone-java

Here is an example of HelloJava application:

Create a new file with command nano HelloJava.java and write the code from bellow.

public class HelloJava {
public static void main(String args[]) {
System.out.println(“Hello, Java”);
}
}

Now ctrl+x to save and exit then compile the source file:
jikes –cp /usr/lib/rt.jar HelloJava.java
Now you can run the application using:
java HelloJava

 

java

5 thoughts on “Java on iOS 4 (iPhone)

  1. But how can we run java in safari? Or run jars? I know i could type: jamvm -jar jarfile.jar, but this does not work most of the time; only for very simple applets, which jar files usually are not.

  2. I have ambitions of installing a Minecraft server on my appletv 2. Since it and the iPhone run iOS, instructions for setting up a Java VM should apply to both. Any tips on how I could install Java for the purpose of running MinecraftServer.jar ?

    This is the output I get, after installing JamVM as a newb and not knowing anything about classpaths:

    Apple-TV:~ root# /Applications/Minecraft/minecraft_server.jar
    -sh: /Applications/Minecraft/minecraft_server.jar: Permission denied
    Apple-TV:~ root# cd /Applications/Minecraft/
    Apple-TV:/Applications/Minecraft root# ls
    banned-ips.txt minecraft_server.jar server.log server.properties
    banned-players.txt ops.txt server.log.lck world/
    Apple-TV:/Applications/Minecraft root# java minecraft_server.jar
    java.lang.NoClassDefFoundError: minecraft_server/jar
    <>
    Caused by: java.lang.ClassNotFoundException: minecraft_server.jar not found in java.lang.ClassLoader$1{urls=[file:/Applications/Minecraft/./], parent=null}
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:529)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 41)
    at java.lang.ClassLoader$1.loadClass(ClassLoader.java :1112)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 93)
    Apple-TV:/Applications/Minecraft root#

  3. i wanted to do the same my first problem was i couldnt use a screen but i didnt needed one u can start that with
    java -Xmx500M -jar craftbukkit.jar
    but it sais

    22:24:55 [WARNING] **** FAILED TO BIND TO PORT!
    22:24:55 [WARNING] The exception was: java.lang.NoSuchMethodError: setPerformancePreferences
    cause the java i installed doest want do run like i want

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.