Tutorial: компиляция и запуск Java приложения на IPhone
Сохранить
Данное руководство описывает шаг за шагов как использовать установленный на IPhone пакет программ Java. Если вдруг на вашем IPhone еще нет Java, то здесь можно найти описание как это сделать.
Итае нам понадобится работающий jailbrak-нутый IPhone с установленной Java . Я использовал IPhone c последней прошивкой 1.1.4, разлоченной и кастомизированной с помощью winpwn.
Шаг 1: Создаем простое Java приложение, компилируем и запускаем.
Создайте файл Java4IPhone.java с простым hello-world кодом внутри. Я использовал этот код:
Загрузите файл в IPhone. Я использовал директорию /tmp. Для загрузки я использовал популярную программу IPhone Browser
Запустите Terminal
Запустите команду java -fullversion или jamvm -fullversion, чтобы проверить доступна ли java
Для вызова компилятора используется команда jikes
Перейдите в директорию /tmp, с помощью команды cd /tmp
Скомпилируйте. Необходимо передать через переменную classpath путь к базовым пакетам java. Если этого не сделать компилятор выдаст ошибку (см. скриншот экрана). Итак для компилящии программы, введите следующую команду: jikes Java4IPhone.java -cp /usr/lib/rt.jar
После этого появится новый файл Java4IPhone.class. Для запуска используйте соманду java Java4IPhone
Взгляните на иллюстрации. Надеюсь, у вас что-то похожее.
I got these when i tried to compile file JavaSysInfo.java:
E:\javapro>javac JavaSysInfo.java
JavaSysInfo.java:31: can not file symbol
symbol: method fullScreenApplicationContentRect()
location: class obc.UIHardware
CGRect rect = UIHardware.fullScreenApplicationContentRect();
^
JavaSysInfo.java:34: can not find symbol
symbol: method defaultSize()
location: class obc.UINavigationBar
CGSize sizenavbar = UINavigationBar.defaultSize();
^
2 errors
Is it that the jocstrap(jocstrap_1.0.2549-8_iphoneos-arm.deb) I got does not fit the source files?
I hope you can help me, well i´ve got every think installed and running but points 7 & 8 are no too clear for my, my file is a .jar one, so i shud´nt compile it, do i? i have tried and nothing, also ia tried to run it by java (filename) but thrn again nothing, im on a 3.1.2 jailbreak os, help me pleas i just want tu run java apps on my Iphone
ok, i did it, but... a igot an other prob, when i exec the file becomes a Main-Class on Manifest error, it is a app for a symbian mobile, so, How can i fix this, does anybody knows it? help my pls
argh, when will Apple decide to finally accept Java, so we won't have to use these kind of complicated (and borderline) techniques ?
Anyway, to compile and run Java application (with UI, WithRat ) on iPhone, I've tried something called iSpectrum.
It complies with the iPhone SDK agreement, since you no longer need to install a JVM, but compiles your Java app to native code. So there is no need to jailbreak your phone .
And you develop in Eclipse, with a plugin of their own, and you can even debug your code right from Eclipse Java editor!
hello...
how can i run - MRemote.jar ?
when i open the MRemote.jar with winrar ,it is include this files = a.class,b.class,c.class,d.class,e.class,MRemote.class,MRemote.png and folder META-INF and MANIFEST.MF .
Hello, I have the same problem. I have a .jar file that was transferred on the jail break iPhone and now i'm trying to install using terminal and when I use the code
"jikes blooover2.jar -cp /usr/lib/rt.jar" it says "the input file "blooover2.jar" does not have the .java extension
how would you compile using other packages? I'm trying to compile processing, so I need to use the "core.jar"
[Reply]
Callum Reply:
July 1st, 2012 at 12:09 pm
Jikes file.java -cp core.jar
Not sure if that's right, give it a go.
[Reply]
neufuture
9 Dec 08 at 8:14 pm
how can i compile java UI Applications with jikes?
And where can i get documents of the lib jocstrap.jar?
Thanks!
[Reply]
WithRat
24 Jun 09 at 11:28 am
I got these when i tried to compile file JavaSysInfo.java:
E:\javapro>javac JavaSysInfo.java
JavaSysInfo.java:31: can not file symbol
symbol: method fullScreenApplicationContentRect()
location: class obc.UIHardware
CGRect rect = UIHardware.fullScreenApplicationContentRect();
^
JavaSysInfo.java:34: can not find symbol
symbol: method defaultSize()
location: class obc.UINavigationBar
CGSize sizenavbar = UINavigationBar.defaultSize();
^
2 errors
Is it that the jocstrap(jocstrap_1.0.2549-8_iphoneos-arm.deb) I got does not fit the source files?
[Reply]
WithRat
24 Jun 09 at 11:36 am
I hope you can help me, well i´ve got every think installed and running but points 7 & 8 are no too clear for my, my file is a .jar one, so i shud´nt compile it, do i? i have tried and nothing, also ia tried to run it by java (filename) but thrn again nothing, im on a 3.1.2 jailbreak os, help me pleas i just want tu run java apps on my Iphone
[Reply]
soulaway Reply:
February 14th, 2013 at 2:40 am
Just try to change current video settings on your device before you do catch such JavaSysInfo.java:31: can not file symbol.
[Reply]
Ruben
17 Jan 10 at 10:22 pm
ok, i did it, but... a igot an other prob, when i exec the file becomes a Main-Class on Manifest error, it is a app for a symbian mobile, so, How can i fix this, does anybody knows it? help my pls
[Reply]
Ruben
18 Jan 10 at 12:18 am
argh, when will Apple decide to finally accept Java, so we won't have to use these kind of complicated (and borderline) techniques ?
Anyway, to compile and run Java application (with UI, WithRat ) on iPhone, I've tried something called iSpectrum.
It complies with the iPhone SDK agreement, since you no longer need to install a JVM, but compiles your Java app to native code. So there is no need to jailbreak your phone .
And you develop in Eclipse, with a plugin of their own, and you can even debug your code right from Eclipse Java editor!
Plus, this is free for open source projects .
Check it out athttp://www.flexycore.com
[Reply]
meelooz
19 Feb 10 at 10:55 am
I just can't understand, will this iSpectrum enable opera mini on iphone which is a java application??
[Reply]
admin Reply:
November 24th, 2010 at 6:03 pm
this will not make java apps work. as for opera mini, there is opera mini app for iphone
[Reply]
Margarett
24 Nov 10 at 4:36 pm
hello...
how can i run - MRemote.jar ?
when i open the MRemote.jar with winrar ,it is include this files = a.class,b.class,c.class,d.class,e.class,MRemote.class,MRemote.png and folder META-INF and MANIFEST.MF .
how can i run - MRemote.jar ?
thanks...
[Reply]
admin Reply:
July 8th, 2011 at 12:24 am
java -jar?
[Reply]
mike Reply:
February 1st, 2015 at 12:43 am
Hello, I have the same problem. I have a .jar file that was transferred on the jail break iPhone and now i'm trying to install using terminal and when I use the code
"jikes blooover2.jar -cp /usr/lib/rt.jar" it says "the input file "blooover2.jar" does not have the .java extension
[Reply]
admin Reply:
February 3rd, 2015 at 5:08 pm
jikes is a compiler, not the runtime. since you have jar file, it is already compiled, you need to run it with java -jar.
[Reply]
rami
7 Jul 11 at 11:41 pm
Hello!
Can you do this procedure with a un-jailbraked iPhone??
[Reply]
admin Reply:
October 25th, 2017 at 12:23 am
Unfortunately, no.
[Reply]
Ryuk
24 Oct 17 at 6:47 pm