BlackBerry with Eclipse(推荐)
来源:互联网 发布:西南交大犀浦地址淘宝 编辑:程序博客网 时间:2024/05/16 17:10
A few years ago I posted (in the former BlackBerry Java Developersforum) steps for getting the HelloWorld demo to compile and debug inEclipse using "etaras anttask." Since etaras nolonger exists, and I haven't (yet) become happy with the EclipsePlugin, I have rewritten those steps for using the bb-ant-tools andupdated and tested the steps for compatibility with Eclipse 3.4.1 andBlackBerry JDE 4.3.0. You should also be able to use newer JDE's aswell. 5. Select Standard VM. 6. JRE home = the location of your Sun JRE. For example: C:/Java/jdk1.5.0_11/jre JRE = Use the specific JRE that you created above. 4. Click Finish. Add the bb-ant-tools jar to the project 2. In Eclipse's Package Explorer, right-click to highlight the Helloworld project folder. 2.There should already be a src folder. If not, right-click the projectfolder, select New > Source Folder, name it src, click Finish. 3. Create an output folder. Right-click the project folder, select New > Folder, name it output, click Finish. 14.Copy all seven or so files with names beginning HelloWorldRes from theresource folder in the Windows Explorer (at the same level as thehelloworld folder) into the new resource folder in Eclipse. <project name="${description}" default="buildRIM" basedir="."> <taskdef <property name="jdehome" <property name="simulator" value="${jdehome}/simulator" /> <property name="bin" value="${jdehome}/bin" /> <target name="debug" depends="deploy" description="Builds, Deploys Project and Launches Remote Debug Server"> <target name="simulate" depends="deploy" description="Builds, Deploys Project and Launches Simulator"> <target name="buildRIM" description="Builds Project"> </project>
Prerequisites
1. You have installed Eclipse 3.4.1 or later.
2. You have installed the BlackBerry JDE 4.3.0. Find it at http://na.blackberry.com/eng/developers/javaappdev/devtools.jsp
3. You have installed Sun's JDK 5.0. Find it at http://java.sun.com/j2se/1.5.0/download.jsp
Extend the Sun JRE
1. Start Eclipse.
2. In the menubar, click Window > Preferences.
3. Select Java > Installed JREs.
4. Click Add.
JRE name = jre_1.5.0+rim4.3.0 (or whatever you like)
7. Click Add External JARs.
8.Browse to the lib folder of you installation of the BlackBerry JDE. Forexample: C:/Program Files/Research In Motion/BlackBerry JDE 4.3.0/lib
9. Select net_rim_api.jar.
10. Click Open.
Add the RIM API documentation
1. Still in the Add JRE window, expand the net_rim_api.jar file.
2. Select Javadoc location.
3. Click Javadoc Location... button.
4. Click Browse.
5.Navigate to the docs/api folder of your BlackBerry JDE installation.For example: C:/Program Files/Research In Motion/BlackBerry JDE4.3.0/docs/api
6. Click OK. Click Finish. Click OK.
Create a new Helloworld Java Project
1. On the taskbar, click File > New > Project.
2. Select Java Project and click Next.
3. Project name = Helloworld
1. Download the bb-ant-tools.jar from http://bb-ant-tools.sourceforge.net.
3. Click New > Folder.
4. Folder name = lib.
5. Click Finish.
6. Copy bb-ant-tools.jar into Eclipse in the new lib folder.
7. Expand the lib folder and right-click bb-ant-tools.jar.
8. Click Build Path > Add to Build Path.
Copy Helloworld into the project
1. In Eclipse's Package Explorer, expand the Helloworld project folder.
4. Right-click on the src folder.
5. Click New > Package.
6. Name = com.rim.samples.device.helloworld
7. Click OK.
8.From the Windows desktop, open a Windows Explorer and navigate to theBlackBerry JDE's helloworld project. For example: C:/ProgramFiles/Research In Motion/BlackBerry JDE4.3.0/samples/com/rim/samples/device/helloworld
9. Copy the HelloWorld.java file from Windows Explorer into Eclipseunder the Helloworld project's com.rim.samples.device.helloworldpackage. HelloWorld.java will indicate a compile error because theHelloWorldResResource interface is generated on-the-fly by theBlackBerry RAPC compiler.
10. In Eclipse's Package Explorer, right-click on the Helloworld project folder.
9. click New > Folder.
11. Folder name = resource.
12. Click Finish.
13. Copy the files from the BlackBerry JDE's helloworld project img folder into the new resource folder in Eclipse.
Create the build.xml ant task
1. In Eclipse's Package Explorer, right-click the Helloworld project folder.
2. Click New > File.
3. File name = build.xml.
4. Click Finish.
5.Put the XML at the end of this file as the content of the build.xml. Besure to modify any file paths appropriately. Modify the bat filereferenced by the simulate task to refer to the device that you wish tosimulate. For documentation on the elements of this ant task see http://bb-ant-tools.sourceforge.net.
6. Right-click build.xml.
7. Click Run As > Ant Build...
8. Under the Targets tab, check only buildRIM.
9. Click Run.
10. The message BUILD SUCCESSFUL should appear in Eclipse's console output.
11. Right-click the output folder in the Helloworld project and click Refresh. The generated BlackBerry JDE files should appear.
Simulate the Helloworld project
1. In Eclipse's Package Explorer, right-click build.xml.
2. Click Run As > Ant Build...
3. Under the Targets tab, check only simulate.
4. Click Run.
Note:The BlackBerry executable files are deployed under the BlackBerry JDE'ssimulator folder. For example: C:/Program Files/Research InMotion/BlackBerry JDE 4.3.0/simulator. You can run the clean.bat filein this folder to delete all of the files deployed since the JDK wasinstalled.
Debug the Helloworld project
1. In Eclipse's Package Explorer, right-click build.xml.
2. Click Run As > Ant Build...
3. Under the Targets tab, check only debug.
4. Click Run.
5. The RIM Remote Debug Server will launch.
6. In Eclipse's Package Explorer, right-click the Helloworld project folder.
7. Click Debug As > Debug Configurations.
8. Highlight Remote Java Application.
9. Click New.
10. Click Debug.
Note:According to the BlackBerry Application Developer Guide if you see themessage "Failed to connect to remove VM. Connection timed out",increase the Debugger Timeout in Eclipse under Windows > Preferences > Java > Debug > Communication.
build.xml content:
(Modifyany file paths appropriately. Modify the bat file referenced by thesimulate task to refer to the device that you wish to simulate. Fordocumentation on the elements of this ant task see http://bb-ant-tools.sourceforge.net.)
<?xml version="1.0" encoding="UTF-8"?>
resource="bb-ant-defs.xml"
classpath="lib/bb-ant-tools.jar" />
value="C:/Program Files/Research In Motion/BlackBerry JDE 4.3.0" />
<exec executable="cmd.exe" dir="${bin}" spawn="true">
<arg value="/c" />
<arg value="jdwp.bat" />
</exec>
</target>
<exec executable="cmd.exe" dir="${simulator}" spawn="true">
<arg value="/c" />
<arg value="8130.bat" />
</exec>
</target>
<target name="deploy" depends="buildRIM" description="Builds and Deploys Project">
<copy todir="${simulator}" overwrite="true">
<fileset dir="output">
<include name="*.cod" />
<include name="*.debug" />
<include name="*.csl" />
<include name="*.cso" />
</fileset>
</copy>
</target>
<rapc jdehome="${jdehome}"
jdkhome="C:/Program Files/Java/jdk1.5.0_11"
destdir="output"
output="HelloWorld"
quiet="false">
<jdp type="cldc"
title="Hello World Demo"
vendor="Vendor=Research In Motion Ltd."
version="Version=0.9"
description="HelloWorld Application"
arguments=""
systemmodule="false"
runonstartup="false"
startuptier="7"
ribbonposition="0"
icon="../resource/helloworld_jde.png">
</jdp>
<src>
<fileset dir=".">
<include name="src/**/*.java" />
<include name="resource/**/*.*" />
</fileset>
</src>
</rapc>
</target>
- BlackBerry with Eclipse(推荐)
- BLACKBERRY DEVELOPMENT WITH ANT & ECLIPSE
- BlackBerry Development with Ant & Eclipse
- 推荐:BlackBerry Developer Newsletter
- BlackBerry 9850应用推荐
- BlackBerry 10 应用推荐
- eclipse + blackberry 类增加
- BlackBerry+eclipse环境搭建
- 推荐两个BlackBerry 商务软件
- 用Eclipse开发BlackBerry应用程序
- 推荐:BlackBerry UI组件例子代码
- White Paper: Mobile Banking with BlackBerry
- blackberry eJDE eclipse plugin update site
- Setup up Eclipse for BlackBerry development
- Blackberry Windows+ eclipse环境配置及Helloworld
- BlackBerry开发环境搭建(eclipse+BlackBerry JDE Plug-in for Eclipse)
- 推荐录像:BlackBerry Super Apps Developer Webcast (Asia Pacific)
- 推荐:Quick tips: Developing apps for the BlackBerry PlayBook
- VF中菜单调用表的过程语句
- [Windows] windump(抓包工具)使用方法简介
- 马上就要毕业了..........
- C# 事件 委托 教程
- static用法小结
- BlackBerry with Eclipse(推荐)
- Java异常基础一
- Ubuntu 9.04下升级Mysql5.0 至5.1
- Intel (R) 82865G Graphics Controller
- //pb中的一些经验和技巧
- OD学习手记——常用断点
- OllyDBG学习手记
- httpclient 传 file MultipartPostMethod类
- 。。。。。