如何将 .jar 文件转换为 .ipa 文件?
我最近制作了一个简单的 .jar 文件,名为“circle.jar”。它所做的只是在屏幕上绘制一个绿色圆圈。该文件的代码如下:
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);
}
}
现在,我想知道是否可以以某种方式将其转换/编译为我的 iPod touch 的 .ipa 文件。我有一台已越狱的第四代 iPod touch。 另外,如果这是不可能的,那么我正在考虑是否可以将 .java 或 .class 文件编译为 Objective-C 文件。我听说过 XMLVM,但要成功使用它,您需要安装了 Cocoa 库。但是,我使用的是 Windows 7 电脑,据我所知,Cocoa 库无法在电脑上下载。 (但是,如果是请告诉我!) 我还意识到确切的代码可能无法针对 iPod touch 进行编译,但这并不重要。该代码仅作为示例给出。 任何帮助都非常感谢! :)
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!
:)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简单的方法可能是在 Objective-C 中编写相同的代码并使用 iOS 开发工具链,将其安装到您的 iPod Touch 上。
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.
维基百科上列出了您的最佳跨平台开发平台。
Your best platforms for cross-platform development are listed on Wikipedia.
有一些工具可以实现此目的,但它们要求您拥有 Mac 以及 99 美元的开发许可证。
例如:Titanium
如果您的 iPhone 已越狱,则不需要开发人员许可证,那么您可以将 .ipa 添加到呼吸站,然后从 Cydia 等下载它。
不过,你仍然需要一台 Mac。
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.