Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Cannot create an instance of Location.Criteria class - lapi.jar MIDP 2.0 J2ME

Reply
Thread Tools

Cannot create an instance of Location.Criteria class - lapi.jar MIDP 2.0 J2ME

 
 
Roland
Guest
Posts: n/a
 
      04-01-2005
Hello

I am trying to find out the good provider for a kind of GPS program
written with j2me midp 2.0 using the location API (lapi.jar) and
Eclipse development environment with the plugin 'eclipseME'.

I have a very strange phenomena.
I try to create an instance of the Criteria class which is part of the
Location API (lapi.jar).

I can compile it without any problems, the program crashes at runtime.
My programm crashes with the following error line:
java.lang.NoClassDefFoundError: javax/microedition/location/Criteria
The lapi.jar is included in the project and the Criteria class exists.

Here is my code:

private LocationProvider FindProvider()
{
LocationProvider oProvider = null;
boolean bProviderFound = false;
int nDistance = 50;

while(!bProviderFound)
{
// set the distance
Criteria oCriteria = new Criteria();
oCriteria.setHorizontalAccuracy(nDistance);
oCriteria.setCostAllowed(false);

try { LocationProvider.getInstance(oCriteria); }
catch(Exception ex)
{
txtGPSData.setString("No provider available - please try
again");
return null;
}

if(oProvider != null)
bProviderFound = true;
}
return oProvider;
}

It crashes exactly where I instantiate the new Criteria object and for
some strange reasons the debugger of eclipse shows me the
Display.class?? But I use my textbox somewhere completely else in my
code.
Unfortunatly the eclipse debugger does not tell me any useful
error-message.

I am not a very good experienced java programmer (normaly doing C#)
and MIDP is quite new for me.
Any help would be very much appreciated. Thanks very much.
 
Reply With Quote
 
 
 
 
Daniel Dyer
Guest
Posts: n/a
 
      04-01-2005
On Fri, 01 Apr 2005 21:47:10 +0100, Roland <>
wrote:

> Hello
>
> I am trying to find out the good provider for a kind of GPS program
> written with j2me midp 2.0 using the location API (lapi.jar) and
> Eclipse development environment with the plugin 'eclipseME'.
>
> I have a very strange phenomena.
> I try to create an instance of the Criteria class which is part of the
> Location API (lapi.jar).
>
> I can compile it without any problems, the program crashes at runtime.
> My programm crashes with the following error line:
> java.lang.NoClassDefFoundError: javax/microedition/location/Criteria
> The lapi.jar is included in the project and the Criteria class exists.
>


Looks like a classpath problem, is the lapi.jar included in the classpath
when you run your app? Are you running on an emulator or an actual
device? You need to configure your emulator or the manifest in your app's
jar file to include lapi.jar in the classapth.

OK, that's my token attempt to answer your question the real reason I
replied is because I'm interested in which device(s) are you planning to
run on? We've been looking at JSR-179 (the J2ME location API) and it
seems to be almost universally unsupported by current generation mobile
phones. It seems to require both CDLC 1.1 for floating point support and
vendor support for the location API on the device (I may be wrong, my
colleagues have looked at this in more detail than I have personally). I
presume you are using some kind of reference implementation in an
emulator? We are targeting Symbian devices and are having to use C++ to
retrieve location information because of the lack of JSR-179 support. I'd
be very interested if you've got it working just with Java.

Dan.


P.S. Anybody else think there should be a comp.lang.java.mobile group?

--
Daniel Dyer
http://www.footballpredictions.net
 
Reply With Quote
 
 
 
 
Roland
Guest
Posts: n/a
 
      04-03-2005
"Daniel Dyer" <> wrote in message news:<op.sokp1hmy8kxzwp@dougal>...
> On Fri, 01 Apr 2005 21:47:10 +0100, Roland <>
> wrote:
>
> > Hello
> >
> > I am trying to find out the good provider for a kind of GPS program
> > written with j2me midp 2.0 using the location API (lapi.jar) and
> > Eclipse development environment with the plugin 'eclipseME'.
> >
> > I have a very strange phenomena.
> > I try to create an instance of the Criteria class which is part of the
> > Location API (lapi.jar).
> >
> > I can compile it without any problems, the program crashes at runtime.
> > My programm crashes with the following error line:
> > java.lang.NoClassDefFoundError: javax/microedition/location/Criteria
> > The lapi.jar is included in the project and the Criteria class exists.
> >

>
> Looks like a classpath problem, is the lapi.jar included in the classpath
> when you run your app? Are you running on an emulator or an actual
> device? You need to configure your emulator or the manifest in your app's
> jar file to include lapi.jar in the classapth.
>
> OK, that's my token attempt to answer your question the real reason I
> replied is because I'm interested in which device(s) are you planning to
> run on? We've been looking at JSR-179 (the J2ME location API) and it
> seems to be almost universally unsupported by current generation mobile
> phones. It seems to require both CDLC 1.1 for floating point support and
> vendor support for the location API on the device (I may be wrong, my
> colleagues have looked at this in more detail than I have personally). I
> presume you are using some kind of reference implementation in an
> emulator? We are targeting Symbian devices and are having to use C++ to
> retrieve location information because of the lack of JSR-179 support. I'd
> be very interested if you've got it working just with Java.
>
> Dan.
>
>
> P.S. Anybody else think there should be a comp.lang.java.mobile group?


Hi Dan

Thanks very much for your answer.
I think you are right, such special functions are not supportet by the
WTK.
I was reading a little bit more in this direction and I realized that
my phone K700 Sony-Ericsson is not supporting at all the Location API.
I wanted to implement this function instead of buying a GPS reciever
(I do not need the position extremly exact
So I decided to stop my little private project and buying a GPS )

I would be very much interested how you are doing this on Symbian.
Are you using MobiInfo API? Or is there another API which is providing
cell informations?

I am absolutly your opinion about the mobile newsgroup - this area
became so waste and becomes more more important that it would be very
useful to have an own newsgroup.

Best regards
Roland
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create SSLSocket on MIDP, J2ME ??? cvraiden Java 0 10-19-2006 12:34 PM
J2ME, MIDP 2.0 and detecting phone number Vagif Abilov Java 12 08-21-2006 07:48 PM
java.lang.NullPointerException at com.sun.kvem.midp.MIDP.run(MIDP.java:651) Fahad Java 1 08-08-2005 02:11 PM
Will application J2ME MIDP 2.0 based of one device run another J2ME MIDP 2.0 device? nishadixit Java 5 06-01-2005 05:40 AM
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class. DJ Dev ASP .Net 3 02-08-2004 04:19 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57