简体   繁体   English

Blackberry-如何在不使用JDE或Eclipse插件的情况下为应用程序主方法指定参数?

[英]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. 我在不使用Blackberry JDE或Eclipse插件的情况下构建应用程序.cod文件。 Everything works fine in the simulator if I hardcode the String arguments which my main() method needs. 如果我对main()方法所需的String参数进行硬编码,则在模拟器中一切正常。 (I am using Maven to build.) (我正在使用Maven进行构建。)

How do you specify main method arguments? 如何指定主要方法参数? In the Eclipse BlackBerry project properties, in the Application tab, you can specify these arguments. 在Eclipse BlackBerry项目属性的“应用程序”选项卡中,可以指定这些参数。 So I assume there must be an equivalent way of doing this by hand-editing the .jdp file or specifying an argument to rapc compiler? 因此,我认为必须通过手工编辑.jdp文件或为rapc编译器指定参数来实现此目的的等效方法?

you can use bb-ant-tools 您可以使用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: 我修改了.jdp文件,添加了以下行:

MidletClass=arg1&arg2

And I modified the .rapc file, modifying the line: 我修改了.rapc文件,并修改了以下行:

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. 现在,我可以使用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. 通过使用官方认可的RIM Eclipse插件,通过Blackberry项目对话框设置主要参数,然后查看该插件如何更改这些基础文件,我了解了所有这些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM