开发者

Blackberry - how do you specify argument(s) to application main method without using JDE or Eclipse plugin?

I am building my application .cod file without using Blackberry JDE or Eclipse plugin. Everything works fine in the simulator if I hardcode the String arguments which my main() method needs. (I am using Maven to build.)

How do you specify main method arguments? In the Eclipse BlackBerry project properties, in the Application tab, you can specify these arguments. So I assu开发者_如何学编程me there must be an equivalent way of doing this by hand-editing the .jdp file or specifying an argument to rapc compiler?


you can use bb-ant-tools

and you can give alternate entry point like this

<rapc destdir="${dist}" jdehome="${jdehome}" jdkhome="${javahome}" output="${output}">
   <jdp type="cldc"
        title="${title}" vendor="${vendor}"
        version="${version}"
        description="${description}"
        systemmodule="true"
        runonstartup="true"
        startuptier="7">
      <entry title="${title}"
             arguments="click"
             systemmodule="false"
             runonstartup="false"
             startuptier="7"
             ribbonposition="0"
             icon="../img/icon.png" />
   </jdp>
   <src>
      <fileset dir="${src}">
         <include name="**/*.java" />
         <include name="resources/**/*.*" />
      </fileset>
   </src>
</rapc>


I found that I had to modify two files.

I modified the .jdp file, adding the line:

MidletClass=arg1&arg2

And I modified the .rapc file, modifying the line:

MIDlet-1: AppTitle,main/resources/icon.png,arg1&arg2

It appears that at least an ampersand & or pipe | character can be used as an argument delimiter. A whitespace character will not work as a delimiter.

Now I can build with Maven. I learned all of this by using the officially-blessed RIM Eclipse plugin, setting the main arguments through the Blackberry project dialog box, and then seeing how those underlying files were changed by the plugin.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜