Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 6
Registered: ‎07-15-2010
My Device: Not Specified

Build Issues when building Widget with a JavaScript Extension

I followed the "Writing JavaScript Extensions" development video to create a JavaScript extension that allows a widget to cause the phone vibrater to activate for a specified amount of time.

 

I used Elcipse to create the JavaScript extension as in the video and used MS VS 8 to create the Widget (I've created other widgets with MS VS 8 without problems).

 

When i went to compile the widget in MS VS 8, the compile completed without error but there was no 'Standardinstall' directory under 'bin' and no *.cod file.

 

I noticed in Eclipse that my SampleExtension.java file has 4 warnings with messages like:

- Signing Required: RIM Blackberry Apps API (0x52424200): Protected Class net.rim.device.api.web.WidgetConfig

- implements net.rim.device.api.web.WidgetExtension.register

 

I noticed that in the video the presenter compiled using 'Released Signed'.  I am trying to compile using 'Debug'

 

Note:  I'm trying to run the application on a BlackBerry 9550 Simulator

 

My Questions: 

1) Is the above behavior normal when building widgets that use JavaScript Extensions?  in other words the compiler won't build a *.cod file unless you build using 'Released Signed'?

2) If I am required to build using 'Released Signed', is it still possible to debug the application?

 

Thanks for your help!

 

BRGlass

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Build Issues when building Widget with a JavaScript Extension

If there is no StandardInstall Directory that means that there was likely a compile error with your javascript extension.  In the VS Error Window are you seeing any errors?

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 6
Registered: ‎07-15-2010
My Device: Not Specified

Re: Build Issues when building Widget with a JavaScript Extension

Here is the output from the VS build:

 

------ Build started: Project: alertWidget, Configuration: Debug Any CPU ------

Running: bbwp.exe "C:\MyProjects\alertWidget\alertWidget\bin\alertWidget.zip" /o "C:\MyProjects\alertWidget\alertWidget\bin" /d

bbwp.exe(0,0): Misc System.Diagnostics.Process (bbwp): Parsing command line options

bbwp.exe(0,0): Misc System.Diagnostics.Process (bbwp): Parsing bbwp.properties

bbwp.exe(0,0): Misc System.Diagnostics.Process (bbwp): Validating widget archive

bbwp.exe(0,0): Misc System.Diagnostics.Process (bbwp): Parsing config.xml

bbwp.exe(0,0): Misc System.Diagnostics.Process (bbwp): Populating widget source

bbwp.exe(0,0): Misc System.Diagnostics.Process (bbwp): java.lang.NullPointerException

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

New Contributor
Posts: 6
Registered: ‎07-15-2010
My Device: Not Specified

Re: Build Issues when building Widget with a JavaScript Extension

A little more information:

 

Using Eclipse IDE for Java:  Build id: 20100218-1602

BlackBerry java Plug-in:  1.1.2.201004161203-16

BlackBerry Java SDK:  5.0.0.25

Visual Studios 2008:  Ver 3.5 SP1

BlackBerry Web Plug-in:  Widget Development 2.0.1.10

Windows XP Professional:  Ver 2002 SP3

 

----------------------------

I think you are correct about the javascript being the problem.  When I removed the AlertSample.jar from the Extensions and removed the 'sample' feature from the local domain in the config.xml the build started producing a StandardInstall folder with .COD files.

 

I went back through the video example and double checked that I had entered everything correctly.  Still doesn't work.  I do see the following warnings on the 'Problems' tab within Eclipse:

 

 

------

Description Resource Path Location Type
Signing Required: RIM Blackberry Apps API (0x52424200): Import uses protected Class net.rim.device.api.web.WidgetConfig SampleExtension.java /SampleWidgetExtension/src/widgetpackage line 7 BlackBerry Protected API

Description Resource Path Location Type
Signing Required: RIM Blackberry Apps API (0x52424200): Import uses protected Class net.rim.device.api.web.WidgetExtension SampleExtension.java /SampleWidgetExtension/src/widgetpackage line 8 BlackBerry Protected API

Description Resource Path Location Type
Signing Required: RIM Blackberry Apps API (0x52424200): Protected Class net.rim.device.api.web.WidgetConfig SampleExtension.java /SampleWidgetExtension/src/widgetpackage line 28 BlackBerry Protected API

Description Resource Path Location Type
Signing Required: RIM Blackberry Apps API (0x52424200): Protected Class net.rim.device.api.web.WidgetExtension SampleExtension.java /SampleWidgetExtension/src/widgetpackage line 10 BlackBerry Protected API

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Build Issues when building Widget with a JavaScript Extension

can you post what the file contents are of the AlertSample.jar file.. you can open it up in WinZip and post a screen shot.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 6
Registered: ‎07-15-2010
My Device: Not Specified

Re: Build Issues when building Widget with a JavaScript Extension

I've attached 3 images showing the contents of the AlertSample.jar.  I've also cut and pasted the SampleExtension.java file that had the warnings at the end.

 

Thanks for the help!

 

 

 

2571iFABD68A1CBD687942572i245B195082F4A7FE2573i508D3156A6CA030C

 

 

package widgetpackage;

import org.w3c.dom.Document;

import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.script.ScriptEngine;
import net.rim.device.api.web.WidgetConfig;
import net.rim.device.api.web.WidgetExtension;

public final class SampleExtension implements WidgetExtension {

 public String[] getFeatureList()
 {
  String[] result = new String[1];
  result[0] = "sample";
  return result;
 }

 public void loadFeature(String feature, String version, Document doc,
   ScriptEngine scriptEngine) throws Exception
 {
  if (feature == "sample")
  {
   scriptEngine.addExtension("sample.alert", new AlertSample());
  }
 }

 public void register(WidgetConfig widgetConfig, BrowserField browserField) {
  // TODO Auto-generated method stub

 }

 public void unloadFeatures(Document doc) {
  // TODO Auto-generated method stub

 }

}

 

New Contributor
Posts: 6
Registered: ‎07-15-2010
My Device: Not Specified

Re: Build Issues when building Widget with a JavaScript Extension

Inserting larger versions of the image file so they are more readable.

 

2574i855DF2FE8A850A522575i11C16D881CFD1CAD2576i2763C6D328B31AD9

New Contributor
Posts: 6
Registered: ‎07-15-2010
My Device: Not Specified

Re: Build Issues when building Widget with a JavaScript Extension

Ok, so I found my problems.  There were 2 of them.

 

1)  I was seeing a java null ptr reference in VS when I compiled the widget with the alertSample.jar.

 

It turns out that my library.xml had the element <extensions> plural which is incorrect.  It should have been <extension>

 

The null ptr reference was due to the fact that the compiler was looking for the "extension" element and it didn't exist.  Its a pity that the error message didn't give more information.  It took me a while to find this.

 

2) I was exporting the jar file incorrectly.  I had the "Export generated class files and resources" checked instead of "Export Java source files and resources" checked. 

 

Once I made the above corrections everything started working fine.

 

-BRG