How to run little java programs in MobileTerminal

Here is a new little tutorial that shows you how to run littles Java programs in MobileTerminal.

Needed for this tutorial :

  • A jailbroken iDevice
  • MobileTerminal installed on it

First, go in Cydia. Be sure to have the developer “profile” turned on (Manage –>; Settings –>; Developer). Now, you have to search this :

  • iPhone/Java (it will install others needed packages).
  • Jikes.

20121229-011323.jpg

20121229-011331.jpg

Just install these packages. Now, you have to do a Java file. For example, you can just type this in the file (name it test.java in this case) :

public class test{
public static void main (String args[]){
System.out.println("Hello World!");
}
}

You can do it on your iDevice if you have iFile or any other file manager or you can do it on your computer and then transfer it with iFunBox (in this tutorial, I put the file in /var/mobile).

Now that you’ve made all what is written, open MobileTerminal. Type jikes test.java -cp /usr/lib/rt.jar (or the name_of_your_file.java).

20121229-011743.jpg

Type on the “return” button. You have now to type java test (or the_name_of_your_file), just type one more time on the “return” button, wait a bit and it will show the message 🙂 .

20121229-011845.jpg

If you have any tip or problem, you can post a comment 😉 .

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s