Wednesday, September 30, 2009
How to include external jar file in BlackBerry Eclipse plugin
7 thoughts Written By Shimul at 1:25 PMYou might need to preverify the jar file. This is how you can preverify a jar file
Go to your JDE installation folder, for Windows XP it is usually C:\Program Files\Research In Motion\BlackBerry JDE 4.3.0\bin. If you are using eclipse then you can also find the installation directory of BlackBerry plugin.
2. Copy your jar file to bin folder.
3. Notice the preverify.exe file. This is the tool we'll use.
4. Now open your command prompt and change your current directory to your JDE installation directory.
5. execute the following command:
preverify -classpath "JDE_PATH_HERE\lib\net_rim_api.jar" "your_jar_filename"
6. Notice that in bin directory, another folder named output has been created. Preverified jar file resides here. Copy the preverified jar file with the same name that the non-preverified jar file has.
7. Now replace the non-preverified jar file with the verified one. Use this jar in next steps
Create a new Blackberry project with any name like LibProject.
Right-click on the project and go to Properties.
Go to Blackberry Project Properties. Click on the Application tab.
Under Project Type, change to Library.
Next, go to the Java Build Path.
go to libraries and add the jar file as an external library.
Go to Order and Export tab here, and mark your jar file as exportable
Click OK.
Build the library project.
Now, create your main BlackBerry project
Keep this projects type to as you wish it to be.
Now go to the properties of this project, In the Java Build Path, add the LibProject project as a Project dependency.
You are pretty much ready to import the jar in your code. Try to import a class and see if it works.
Alternatively, what I think that we might skip the first works of creating a new project and try to add the jar directly to our app. I think that might also work. Though I did not try it yet. Let me know if anyone was successful doing it.
That’s all for now
Labels: Blackberry, Eclipse, Java