Using netbeans with BB-ant-tools to compile BlackBerry applications

Source: Internet
Author: User
Tags echo message netbeans

First install the netbeans development plug-in

Then add "Java platform management"-> j2-> customize the j2-platform simulator (this is the meaning after translation) and then add the path of the BB simulator.

Then fill in some basic information (skipped)

After the next step, remove all jar packages excluding net_rim_api.jar (only one net_rim_api.jar is retained)

 

Then create

Modify default build. xml

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <! -- You may freely edit this file. See commented blocks below for --> <br/> <! -- Some examples of how to customize the build. --> <br/> <! -- (If you delete it and reopen the project it will be recreated .) --> <br/> <project name = "blackberryzwherecallme" default = "jar" basedir = ". "> <br/> <description> builds, tests, and runs the project. </description> <br/> <import file = "nbproject/build-impl.xml"/> <br/> <! -- Define the task Syntax --> <br/> <typedef resource = "bb-ant-defs.xml" classpath = "E:/bb-ant-tools.jar"/> <br/> <property name = "rim. blackberry. home "location =" C:/program files/Research In Motion/BlackBerry jde 4.5.0 "/> <br/> <property name =" rim. blackberry. emulator "value =" 8700-black "/> <br/> <property name =" rim. blackberry. jdwp. port "value =" 8001 "/> <br/> <! -- Cod file directory --> <br/> <property name = "Dist" value = "E: /codeproject/blackberryzwherecallme/Dist/SNK "/> <br/> <target name =" bbbuild "Description =" BlackBerry build "depends =" init "> <br/> <mkdir dir = "$ {Dist}"/> <br/> <rAPC quiet = "false" output = "$ {name}" <br/> jdehome = "$ {rim. blackberry. home} "<br/> destdir =" $ {Dist} "<br/> srcdir =" E: /codeproject/blackberryzwherecallme/src "> <br/> <jdp <br/> Title =" zwher Ecallme "vendor =" zhangjianying "version =" 0.1 "Description =" is copyright by zjy "<br/> systemmodule =" true "<br/> runonstartup =" true "startuptier = "7" type = "library"/> <br/> </rAPC> <br/> </Target> </P> <p> <target name = "post- jar "> <br/> <antcall target =" bbbuild "/> <br/> <! -- <Br/> <exec OS = "Windows NT Windows 95 Windows 98 Windows 2000 Windows XP" <br/> dir = "$ {Dist. root. dir} "<br/> executable =" $ {rim. blackberry. home}/bin/rapc.exe "<br/> failonerror =" true "resolveexecutable =" true "> <br/> <Arg value =" Import =$ {rim. blackberry. home}/lib/net_rim_api.jar "/> <br/> <Arg value =" codename =$ {name} "/> <br/> <Arg value ="-MIDlet "/> <br/> <Arg value = "library = blackberryzwherecallme"/> <Br/> <Arg value = "blackberryzwherecallme. rAPC warnkey = 0x52424200; 0x52525400 "/> <br/> <Arg value =" Jad =$ {Dist. jad} "/> <br/> <Arg value =" $ {Dist. jar} "/> <br/> </exec> <br/> --> <br/> <! -- <Br/> <echo description = "" >$ {jde. home}/lib/net_rim_api.jar </echo> <br/> <rAPC output = "blackberryzwherecallme" <br/> jdkhome = "E: /documents/jdk_ibm "<br/> quiet =" false "<br/> srcdir =" E: /codeproject/blackberryzwherecallme/src "<br/> Import =" $ {jde. home}/lib/net_rim_api.jar "<br/> jdehome =" $ {jde. home} "> <br/> <jdp Title =" kick ass app "vendor =" slashdev "version =" 1.0 "type =" library "/> <br/> </ rAPC> <br/> --> <Br/> <! -- <Copy file = "$ {name }. alx "todir =" $ {Dist. root. dir} "/> --> <br/> </Target> </P> <p> <target name =" run "depends =" init, jar "> <br/> <echo message =" dddd === {Dist. root. dir} "/> <br/> <copy todir =" $ {rim. blackberry. home}/Simulator "verbose =" true "> <br/> <fileset dir =" $ {Dist. root. dir}/SNK "> <br/> <include name =" **/$ {name }. * "/> <br/> </fileset> <br/> </copy> <br/> <exec OS =" Windows NT Windows 95 Windows 98 Windows 2000 Windows XP" <br/> dir = "$ {rim. blackberry. home}/Simulator "<br/> executable =" $ {rim. blackberry. home}/simulator/$ {rim. blackberry. emulator }. bat "<br/> failonerror =" true "resolveexecutable =" true "/> <br/> </Target> <br/> <target name =" debug "depends =" init, jar "> <br/> <copy todir =" $ {rim. blackberry. home}/Simulator "verbose =" true "> <br/> <fileset dir =" $ {Dist. root. dir} "> <br/> <include name =" **/$ {name }. * "/> <br/> </fileset> <br/> </copy> <br/> <delete file =" $ {preprocessed. dir }/. timestamp "/> <br/> <parallel> <br/> <property name =" JPDA. port "value =" $ {rim. blackberry. jdwp. port} "/> <br/> <Java jar =" $ {rim. blackberry. home}/bin/jdwp. jar "fork =" true "dir =" $ {rim. blackberry. home}/bin "> <br/> <jvmarg value ="-xmx256m "/> <br/> </Java> <br/> <sequential> <br/> <sleep seconds = "5"/> <br/> <antcall target = "nbdebug"/> <br/> </sequential> <br/> </parallel> <br/> </Target> <br/> <target name = "init. rim. blackberry "depends =" init "> <br/> <Condition Property =" rim. blackberry "value =" true "> <br/> <or> <br/> <equals arg1 =" test "arg2 =" $ {config. active} "/> <br/> </or> <br/> </condition> <br/> </Target> <br/> <target name =" post- clean "> <br/> <echo> post clean </echo> <br/> <Delete> <br/> <fileset dir =" $ {rim. blackberry. home}/Simulator "> <br/> <include name =" **/$ {name }. * "/> <br/> </fileset> <br/> </delete> <br/> </Target> <br/> </Project> <br/> 

 

Note:

1. If the JVM cannot be created during compilation

Modify the corresponding netbeans startup parameters in the netbeans/etc directory (this problem may occur if you have optimized it)

Another way is to download the bb-ant-tools.jar source code, modify a piece of code:

Set ca. slashdev. BB. Tasks. rapctask

Under the executerapc () method in

List <string> jvmargs = managementfactory. getruntimemxbean (). getinputarguments ();

For (string Arg: jvmargs ){

If (Arg. startswith ("-X "))

Java. createjvmarg (). setvalue (ARG );

}

Comment out this code.

2. When an unsupported character set warning occurs,

In netbeans, set the properties of the project's character set to warning (such as GBK)

3. Do not use the default Dist file directory as the output directory. If you use the default directory, the source code will be compiled together into the cod file (view the method and open the compiled cod directly with notepad, you will find that the source code is also entered)

Therefore, you can add a sub-directory after Dist, such as SNK, 4.5, 5.0, etc.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.