DalvikVM with Input

拥有回忆 提交于 2019-12-11 08:18:00

问题


How can I start with dalvikvm an .jar-file with an input. Something like that:

dalvikvm -cp /path to jar/test.jar "hello"

The main method of the test.jar will be just print this hello to console. It something like that possible? What is the right way to give this input to the main method, for example as an input for String [] args of the main method.


回答1:


Have you followed these steps? It looks like you need to run something like this:

# /system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar -classpath /data/CmdLine.jar org.apache.HelloWorld /system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar -classpath /data/CmdLine.jar org.apache.HelloWorld

Hello World!




回答2:


I did something similar: /system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar -Xverify:none *-Dosgi.debug=file:/data/.option*s .........-Dosgi.parentClassloader=ext -classpath ..... -console -clean

Instead of passing parameters through String[],I do not know how to do in this case, you could use the -D"nameparameter"="value" format (see adb shell dalvikvm -help) that allows you to define also new parameters (I used only predefined ones) and send them to the vm; then in your main class you could get them using String prop=System.getProperty("nameparameter")



来源:https://stackoverflow.com/questions/8885269/dalvikvm-with-input

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!