If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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

Java Development

Reply
New Developer
wayneuroda
Posts: 10
Registered: ‎09-28-2009
My Device: Not Specified

Possible error in JDE 4.5.0 SDK

I am using Eclipse with bb ant tools to build blackberry applications for about 6 months and haven't had any problems until now.

 

Today when I try to use Graphics.drawtext() in my program eclipse is giving me the error "The type net.rim.device.api.ui.TextMetrics cannot be resolved. It is indirectly referenced from required .class files".

 

I did some poking around in the net_rim_api.jar file and inside the Graphics class it defines the following functions (decompiled Graphics.class using javap):

...

    public native int drawText(java.lang.String, int, int, int, int, net.rim.device.api.ui.DrawTextParam, net.rim.device.api.ui.TextMetrics);
    public native int drawText(java.lang.StringBuffer, int, int, int, int, net.rim.device.api.ui.DrawTextParam, net.rim.device.api.ui.TextMetrics);
    public native int drawText(net.rim.device.internal.ui.StringBufferGap, int, int, int, int, net.rim.device.api.ui.DrawTextParam, net.rim.device.api.ui.TextMetrics);
    public native int drawText(char[], int, int, int, int, net.rim.device.api.ui.DrawTextParam, net.rim.device.api.ui.TextMetrics);

...

 

Notice the net.rim.device.api.ui.TextMetrics in each of these functions? It isn't in the Jar file. Googling it shows that it is in the SDK for v5.0.0, and here it says

"Since:

BlackBerry API 5.0.0"
So I am a little confused. I have completely reinstalled JDE 4.5.0, I also re-downloaded it thinking my installer may have been corrupt - no effect.


I am guessing then that perhaps this isn't really a bug but more of a problem which only shows up when you are using Eclipse? Inside JDE Graphics.drawText has 8 overloaded versions - inside the Graphics.class file there are 13 overloaded versions!


Can anybody enlighten me? For now I think I will just have to put up with eclipse telling me my code has errors, even though RAPC builds it fine.


- Wayne

Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

If I recall correctly, this very same error used to pop up in ancient JDEs (e.g., 4.0 or 4.2) years go when the wrong (newer) version of Java compiler was used. Can this be what's happening here?

Please use plain text.
New Developer
wayneuroda
Posts: 10
Registered: ‎09-28-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

I am using JDK 1.5.0_07 and I have tried the latest 1.6.0, it doesn't seem to have an effect. Do you know what version I should be trying? It is probably time I tried out the official eclipse plugin anyway.
Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

[ Edited ]

Are you 100% sure that you do not have mulitple versions of net_rim_api.jar on your classpath?

Please use plain text.
New Developer
wayneuroda
Posts: 10
Registered: ‎09-28-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

Yep only have one net_rim_api.jar on my PC
Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

[ Edited ]

Not sure whether this will help, but try specifying 1.3 or 1.1 as the target version of the bytecode using the -target switch of javac. Similarly, play around with the -source switch. Best of all, see what switches the JDE v4.5 passes to javac.

Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

Is it a specifc drawText call  (I mean just one of the overloaded methods) showing you the Eclipse error or do you always get this error irrespective of the drawText method?

Please use plain text.
New Developer
wayneuroda
Posts: 10
Registered: ‎09-28-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

The problem only seems to arise when I use any of the drawtext functions - in fact drawtext is the only method or field I am using from Graphics, so it may just be a coincidence. I will check if it occurs when I use any other methods.
Please use plain text.
New Developer
davidn70
Posts: 1
Registered: ‎12-20-2009
My Device: Not Specified

Re: Possible error in JDE 4.5.0 SDK

I know this is an older thread but I just ran into the same problem - here's my "fix".  I created an empty class with that name/package and stuck it in a jar in eclipse's classpath - problem solved - just make sure you don't accidentally deploy that class - you will get a security violation.

 

Enjoy!
David

Please use plain text.