How do I convert a .jar file to a .ipa file?

4.5k Views Asked by At

I recently made a simple .jar file called "circle.jar". All it does is draw a green circle to the screen. The code to the file is below:

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;    
public class CircleDraw extends Frame {
    float x;
    Shape circle = new Ellipse2D.Float(110.0f, 40.0f, 100.0f, 100.0f);
    public void paint(Graphics g) {
    Graphics2D ga = (Graphics2D)g;
    ga.setColor(Color.green);
    ga.draw(circle);  
    ga.setPaint(Color.green);
    ga.fill(circle);
}
public static void main(String args[]) {
    Frame frame = new CircleDraw();
    frame.addWindowListener(new WindowAdapter(){
        public void windowClosing(WindowEvent we){
            System.exit(0);
      }
    });
    frame.setSize(320, 480);
    frame.setVisible(true);
  }
}

Now, I was wondering if I could somehow convert/compile this to a .ipa file for my iPod touch. I have a 4th generation jailbroken iPod touch. Also, if this is not possible, then I was pondering whether or not I could compile the .java or the .class file to an Objective-C file. I have heard of XMLVM, but to successfully use it you would need to have the Cocoa Library installed. However, I am using a PC with Windows 7 and as far as I know, the Cocoa Library is not available for download on a PC. (However, if it is please let me know!) I also realize that the exact code may not be able to compile for the iPod touch, but that doesn't matter. The code was just given as a sample. Any help is greatly appreciated! :)

3

There are 3 best solutions below

3
On

There are some tools for this, but they require you to have a Mac together with a developing licence for 99$.

For example: Titanium

You wouldn't need a developer license if your iPhone is jailbreaked though, then you could just add the .ipa to a respitory and then download it from for example Cydia. You'll still need a Mac, though.

2
On

The easiest way is probably to just write that same code in Objective-C and use the iOS development toolchain to get it on your iPod Touch.

0
On

Your best platforms for cross-platform development are listed on Wikipedia.