Setup up Eclipse for BlackBerry development
This is yet another post describing how to setup Eclipse for BlackBerry development work. When I was getting started on my BlackBerry project, I must have read a dozen such posts and articles. None of them gave me all that I needed to get everything working. Hopefully this post will do just that.
I do ask that if you find an error, or something does not work, please post the problem, and hopefully the solution.
However first a caveat. Just 2 weeks ago, when I was downloading programs and setting things up, I was downloading the latest versions of the programs that were available at the time. Now, as I write this post, some of the programs have newer versions available. I will write these instructions using the versions I have installed. I hope there won’t be any significant differences with the newer versions.
1. Download and Install
1.1. JDK from http_://java.sun.com/javase/downloads/index.jsp. I have JDK 6 Update 6, which is the current (non-beta) version.2. Other useful downloads
2.1. Mobile File Manager from http_://www.rovemobile.com/products/freeproducts/mfm/features/. This awesome program allows you to view and manage the file system on the BlackBerry, edit files and even setup an FTP from the BlackBerry to a server. I did not use the FTP feature.3. Eclipse Setup
3.1. Workspace PreferencesThat pretty much does it for setting up Eclipse for BlackBerry development. I do however have some other tips that I’ve learned.3.1.1. Install the JRE with Javadocs. Note that the following steps assume that in your Eclipse workspace, you will only be doing projects for the BlackBerry. Projects for J2SE or other environments will need to be put into a different Eclipse workspace.3.2. Project Setup. The default situation for Eclipse is to have the source code for a project located in the directory tree that you specified for the workspace. However I already had the source files located elsewhere. So I needed to setup the project differently.126.96.36.199. Click Window > Preferences from the main menu in Eclipse3.1.2. Set the JDK Compliance Level – Since the JRE we started with was version 6, the default compliance setting will be 6.0. But the BlackBerry JDE is not at that level.
1. Remove unwanted applications from the simulator. In the Simulator directory (eg. C:\jde\simulator) is a file called 8820.xml (assuming you are looking at the 8820 simulator). Remove from this file the lines that specify applications you don’t care to have loaded in the simulator. This will remove clutter from the simulator’s main menu. It may also speed up loading of the simulator, but not by much.
2. Remove your projects from the simulator. Both of the following steps must be done.
2.1. In the simulator directory (eg. C:\jde\simulator), there are 3 files for each of your projects. Delete all 3 of them. They are:3. Prevent the simulator’s display from going black.2.1.1. projectName.cod2.2. Run the simulator
3.1. In the simulator window, select View > Keep LCD On. This will affect only the current simulator session4. Installing your project to a physical BlackBerry
4.1. Connect your BlackBerry to your PC with the USB cable.5. Removing your project from a physical BlackBerry4.1.1. I get a pop up on the BlackBerry when I connect it to the PC, asking if I want to enable Mass Storage Mode. No matter what I answer (yes or no) the connection to the PC gets broken. So I just don’t answer the pop up until after I’m finished with the connection. After removing the USB cable the pop up goes away on its own.4.2. On your PC, locate the cod file for your project. It will be in the Eclipse project directory, which is typically under the Workspace directory.
5.1. Connect your BlackBerry to your PC with the USB cable.6. Edit files and navigate the file system on the BlackBerry (physical or simulator).
6.1. Install the Mobile File Manager program to the simulator and/or the physical BlackBerry. Use the BlackBerry Desktop Manager to install this program.7. In Eclipse, name your project with a letter less than ‘n’. When removing your project from the simulator, the modules list has tons of RIM modules that start with “net_rim”. You want your module before that long list of RIM modules.
8. Locate the PIN or IMEI numbers in a physical BlackBerry. Open Options > Status.
1. Automatically add an import statement for an unknown type. Place cursor on the unknown type and hit Ctrl-Shift-m.
2. Organize the import statements – hit Ctrl-Shift-o
3. Have only one main() in your entire project; otherwise when you try to start the project in the simulator, it may not run the desired main(). The simulator will give no indication of why it seems that your program is not starting.
RIMs BlackBerry JDE Plug-In for Eclipse
I downloaded version 188.8.131.52 (the latest) of this plug-in. In a word, don't bother. According to RIM support, it only works with version 3.3.1 of Eclipse, so it would not work with the 3.3.2 version that I have. It also will not work on Windows 2000 (which I also use).
Improvements Needed to the above Instructions
• It would be really nice if only changed java files were recompiled. My project currently has over 200 files and will have over 300 when finished.
• It would be nice to have a way to specify the class containing the desired main() to be run.
My thanks to the many authors whose posts and articles and answers to my questions have helped me get this far. I'm sure you see your work in the above. Thank you.
Great Job Paul!!
this will be a lot of help to most of us on the forum!
I dont understand what the benefits of using eclipse are? The IDE that blackberry distribute is excellent and provides everything you need? Why use eclipse?
@plevintampabay: most excellent post. vote for sticky!
Skynetchris -- just in case you are not kidding -- Yes the JDE gives you everything you need, if your program is one or two files. Actually I did a test program with about 5 files (5 classes) and everything went well.
Using the debugger in the JDE is actually better (faster, more responsive and no strange things happening) than using the debugger from Eclipse. But my program has over 200 files right now. The JDE is totally unusable at that size.
You can't find all references to a variable, method, or class. You can't do effective searches. The JDE does have limited completion (pops up the methods in a class) but nothing like the features in the Eclipse. Try writing code in Eclipse for a while and you'll never go back to the JDE.
To be fair, I have not tried the latest JDE. Maybe it has tons of new features. I'll have to take a look at it, at some point. Of course Eclipse also has a newer version out too.
I agree with you. Eclipse is much better but I have a problem with Eclipse that never succeed to resolve. I cannot debug in Eclipse. I made everything that has been written up there. I launch the simulator through Eclipse using JDWP, the simulator is running but the application is not started. I need to go to start it by myself and then there are no debug variables, the breakpoints are not working. The only way I can "debug" (it is not debuging exactly) is to put message on the JDWP console (output) using System.out stream. Has anyone had this problem ?
C:\EclipseBlackBerry\D2LBlackberryClient\build.xml :3: java.lang.UnsupportedClassVersionError: ca/slashdev/bb/RapcTask (Unsupported major.minor version 49.0).
Could somebody tell me how to fix it?
I'm not kidding, and I still dont see any 'advantages' to using Eclipse. Yes its opensource, yes its pretty, yes its good at what its MEANT to do.
So here the positives of installing the BB IDE:
- One install, no setup required
- Runs debugger
- Runs multiple simulators
- Runs internal calsses (as reccomended by Sun and BB to increase performance, so why -have 200 files?) perfectly fine.
- Can atattch to a device and debug on the device
- Can break point an application at runtime wherever you chose dynamically, just like iphone.
Large projects? (I haven't encountered this and my application is quite large [1500+ lines, 4 threads]).
I did try using Eclipse and its nice, if your doing plain java or something thats not device specific. Anyway, lets keep this fairly factual.
Positives of Eclipse:
*your points here*
- requires a 5 page setup
- doesn't have the same level of debugging/choices
- Doesn't do on device debugging
Execellent post! Thread is now a sticky.
Thanks for the great post, it helped were the eclipse plugin completely fails.
I have question with build.xml. I have a few library jar files that I use. I added them to the RAPC task using the <import> element <import location="/workspace/BlackBerry/MobileBlackBerry/lib/MathEvaluator.jar" />. Everything works fine until I run the application. I get the following exception "Entry point not found for Module MathEvaluator". Any idea what I need to do to get my app to rapc and run.
Thanks for helping out with such an informative post!
Just a quick note to all of the people with questions of why your situation doesn't work -- I'm a realtive beginner here too, so I don't know the answers to your questions. Hopefully others might.
@plevintampabay: Great post! Helped get me up and running with Eclipse in no time.
Finally, to the person wondering why use Eclipse, if you don't know, it is because you don't yet know enough to know you need it. =) And inner classes are great when used where they are indicated/required, but are not a substitute for proper OO design and coding. Just wait till 2 years from now you need to go back and modify your 1500+ line file with multiple sub-classes. Good luck with that! We'd never have a file that big in our shop, and we've written a couple 80,000+ line avionics projects! Knocking Eclipse because it requires a setup is like saying an abacus is better than a computer because you don't have to turn it on!
I do use eclipse, not for BB development.
Those who want even more detail, and a slightly different way of setting up Ganymede, register and login to our Wiki: Main Page - BerrysoftWiki
Over the next few days I'll be adding even more info on the setup, including how to really tweek your build.xml file. Might do an article on it on our Blog: Berrysoft Developer.
I got everything working, but i did notice that eclipse underlines references to classes in my project as an error, basically saying it cannot find that import class. Even thought it compiles and runs.
Anyone else have this issue? It's just ugly seeing a ton of errors in your project, especially when they don't exist.
I'm on Eclipse Ganymede btw
Hi, I´m new to the BlackBerry development , I have a question. I don´t see the package named "files" (there are images and music in it) in the jar file the ant creates before de .cod file. Thanks
Also new to BlackBerry development. Have the following error, anyone know what causes this or how to fix it?
Unable to start simulator. Check that the file exists.(java.io.IOException: Cannot run program "C:\RIM\BlackBerryJDE4.3.0\simulator\fledge.ex e/xxxxx" (in directory "C:\RIM\BlackBerryJDE4.3.0\simulator\"): CreateProcess error=3, The system cannot find the path specified)
Think it has something to do with the Command Line or Workign Directory setup.
Thanks for share !
I am new in BB project with eclipse.
We are planing to keep our BlackBerry project in subversion [.classpath, .project and .jdp file] so that any developer can acquire the source and project
from subversion and then bring up the BB Eclipse and import the existing Blackberry project into eclipse. Our BB project have below structure:
-src [source have our all source code]
-test [ test have sample example program to test]
But looks like File->import -> Blackberry -> Black Berry JDE Project doesn't seems to be working what we want. When we import it is creating
-src [putting the test example sample here]
-src1[ putting the source here]
instead of src and test under BBPROJECT.
Anyone please have experience on this please let me know....
Thanks in advance!!
|All times are GMT -5. The time now is 11:58 PM.|
Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.