views:

150

answers:

2

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 assume there must be an equivalent way of doing this by hand-editing the .jdp file or specifying an argument to rapc compiler?

+3  A: 

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>
Vivart
Thanks for the answer. I've so far been avoiding bb-ant-tools since I can't find it packaged as a Maven artifact. Do you happen to know what this task is doing under the hood to (I assume) the .jdp file with those entry arguments?
Scott Bale
A: 

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.

Scott Bale