开发者

Calling a midlet jar for retrieve data into a python code

I have a JAR file midlet JAR file, which returns an INT value according to some input data...

Problem is, i need to get that INT value by calling the jar file via some python code (and send the required input data to get the result data). How can i access the functions and variables of a midlet JAR file?

I try to decompile JAR into java code, but result was useless. Somehow, i need to开发者_Python百科 get the code or get the related data that evaluated by JAR file?

Is it possible?


Jython has native access to Java code, but I'm not sure if it supports MIDP.


I don't know much about J2ME, but you might be able to use Python's pipe facility to invoke a method in the JAR, e.g. java -jar myjar.jar org.package.Main param1. See also the java command line options for your OS.

Addendum: The example in the pipe documentation shows how to read the result of a command. You may have to write your own main() method that uses introspection in order to invoke the target method with the correct parameters, as discussed in this JavaWorld article: Take an in-depth look at the Java Reflection API.


A MIDlet can not run in a standard desktop JVM because it needs some extra libraries. But you can use an emulator like http://www.microemu.org/ to run the program. How to access a specific function inside the code, call it with specific parameters and read the result will be a real challenge. But MicroEmu is open source, so I'm sure it is possible. You will need some (probably advanced) java skills. Another option lighter than MicroEmu is http://kobjects.sourceforge.net/me4se/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜