10-24-2011 07:15 AM
I got this blackberry tutorial to work using the native code:
---
The tutorial
http://infocenter.sybase.com/help/topic/com.sybase
the zip to the already done tutorial :
http://www.sdn.sap.com/irj/bpx/index?rid=/webconte
---
Now that I got that running, I need to run it in WebWorks
I've managed to create all the code and plugins I need but I just can't get the last bit to work:
when I add the jar inside the plugin: I get the following error when I launch the app
> Error starting MyApp: Module 'MyApp' has verification error 1691 at
> offset 0ed9 (code file version 79)
when I push the jars manually: (this is how the native code app works) I get a classnotfoundexception when I try to call code form the libraries.
My conlcusions are :
- in the case I put the jars inside my plugin, the code is not written in a way that BBWP can compile correctly and causes errors when you launch the app. This can only be fixed by the authors of the lib.
- in the case where I push the lib on the phone, I think I'm missing something in my config to tell my webworks project to use files that are outside the project.
so my question is :
how do I get a blackberry webworks project to use the libs that I deployed onto the device in the same way that the blackberry eclipse plugin does?
Solved! Go to Solution.
10-24-2011 02:00 PM
Hi jason_rogers,
I just want to understand exactly what you're trying here.
If you're trying to reference a 3rd party jar containing compiled code from within a java extension of a webworks app then this can be accomplished. What you must do first is pre-verify the jar using preverify.exe which can be found in the bin folder. Then simply have the compiled jar in the same folder of your java source and everything should work.
If you're trying to use a library application this is slightly more complicated, but likely we can accomplish it, worst case it can be hacked into the source generated from the packager with the -s parameter.
button below the post(s)10-25-2011 05:55 AM
Hi Jeffheifetz
first thanks for your answering, I've been trying to get this to work without any certainty that it will work at all lol.
I'll try to make my problem clearer, I have 3 libraries provided by Sybase that belong to their client API.
for those files I am given :
CommonClient.alx
CommonClient.cod
CommonClient.debug
CommonClient.jad
CommonClient.jar
[the same for the 2 other libraries].
When you follow the tutorial metionned in the first post, you build the app using the eclipse plugin, you have to add the jars to the build path then when you test on the simulator you copy the cod files into the simulator folder, and on the device you have to install the .alx files.
I'm trying to get this to work using webworks by using phonegap (because I have a html5/javascript interface that I already use on ios).
I narrowed down my options to 2 approaches
1) adding the jars to the phonegap project.
2) using them as a library application
the problem is before I started this I had 0 blackberry experience so i'm nearly purely guessing.
when I try 1) I get
but when I do this I get
> Error starting MyApp: Module 'MyApp' has verification error 1691 at
> offset 0ed9 (code file version 79)
I googled it and as you said I should preverify the jar but when I do this I get
console:
C:\BBWP\bin>preverify -classpath C:\BBWP\lib\net_rim_api.jar "C:\sybase new jars \src\sup_client_rim.jar" JAR file creation failed with error -1 The preverified classes if any are in tmp22556. See jar log of errors in output\ jarlog.txt
jarlog.txt
Error: No such file or directory
jar -cfm "output\sup_client_rim.jar" tmp22556\\META-INF\MANIFEST.MF -C tmp22556 .
When I tried 2) I get
I just don't know how to set the phonegap/webworks parameters so that it accesses a library application
Any ideas ?
Cheers
Jason
10-26-2011 11:32 AM
Hi jason_rogers,
This is definately something that can be done, its very similair to what is done for BBM right now.
What you have are a set of compile-time jars and a set of cods that need to be on the device for run time. So what you need to do is add the jars to the buildpath but make sure they are not packaged into your app.
Firstly, its important to note that by adding the jar you can access the APIs from Java, but not javascript. To access from JavaScript you will need to build a custom WebWorks Extension. Luckily there are plenty of examples (you can look at any of our own APIs) or the community api repo here -https://github.com/blackberry/WebWorks-Community-A
If you want to build an extension for phonegap you will then package your webworks extension in a phonegap plugin. I'm not sure how many examples are out there, but I'm sure we can figure it out.
Secondly, to be able to compile your extension and access the 3rd party lib you need to have a dependency section in your library.xml, something like the following.
extension id="blackberry.sybase.extension">
<entryClass>blackberry.sybase.SybaseExtension</ent ryClass>
<dependencies>
<jar path="CommonClient.jar" />
</dependencies>
</extension>
Lastly, to test your application you need to load your app on the device and load CommonClient.cod as well.
Hope that clarifies a few things
button below the post(s)10-27-2011 06:55 AM
Hi Jeff
Thanks for your help,
I have currently dropped phonegap and focused on getting it running with just webworks but still no joy
I have no idea how to create these dependencies (I've been searching and there is 0 information on the webworks pages about creating dependencies between a plugin and a 3rd party lib.
the 2 major questions I can't figure are :
- how do you write a extension that access a third party library ? the only solution I found was to compile a jar sepratly form the project and add that to the project, otherwise we get compilation errors form bbwp. Is this the correct way of doing it ?
- what path do I need to specify in the library.xml ? is it a path in the project? on the hard disk ? on the device ?
I'm attaching a link to our test project
http://dl.dropbox.com/u/40792956/MyExtension.zip
I do hope you'll no tthink its too daring if you could have a look at what we are doing wrong.
CHeers
Jason
10-27-2011 10:21 AM
10-27-2011 10:34 AM
Hi Ababut
To get tutorial of these libraries to work I had to:
- in blackberry eclipse plugin add the jar libraries to the project
- - on the simulator add the cod files in the simulator folder
- - on the device install application using the .alx files
so I would say 1
the libraries I have are precompiled
I am now looking to create a plugin that calls these precompiled libraries.
List of the files given by Sybase
CommonClient.alx
CommonClient.cod
CommonClient.debug
CommonClient.jad
CommonClient.jar
sup_client_rim-1.debug
sup_client_rim-2.debug
sup_client_rim.alx
sup_client_rim.cod
sup_client_rim.debug
sup_client_rim.jad
sup_client_rim.jar
UltraLiteJ-1.debug
UltraLiteJ-2.debug
UltraLiteJ-3.debug
UltraLiteJ-4.debug
UltraLiteJ-5.debug
UltraLiteJ.alx
UltraLiteJ.cod
UltraLiteJ.debug
UltraLiteJ.jad
UltraLiteJ.jar
10-27-2011 10:57 AM