"Package System does not exist" error [SOLVED]

Started by
5 comments, last by Multiverse 17 years, 9 months ago
Hi, I know what your all thinking, but i *have* spelt System correctly in my code! The background is that I've always relied on Eclipse, Eclipse ME and J2ME-Polish, but we have recently had to dump J2ME Polish and switch to using Antenna. Since the switch i've been plagued with problems, which i have managed to overcome, but this one has me stumped. Basically I get an error whenever I use the "System" object.('System.out.println' or 'System.currentTimeMillis' for example) It always worked before when but now it is not, and I cannot find any info about it on the net. When trying to compile my code for a different device, I get the following Error: "Unable to locate package java.lang in classpath or bootclasspath" and I think it is this which is why it cannot find the System package. As I said before I've relied on things to do all the setting up for me before, so now I don't know the basics!! Could somebody tell me how to set this up to use Ant and Antenna or at least give me some hints? Any help at all would be greatly appreciated! EDIT: I've also just noticed that I get another error: "cannot resolve symbol IOException" I assume there is something fundamentaly wrong with the way I've set things up (env variables or whatever), any ideas? [Edited by - Multiverse on July 7, 2006 11:29:51 AM]
Advertisement
Looks like the bootclasspath property in Antenna's WtkBuild task is not pointing to the MIDP library. Which usually means you either have set the wtk.midpapi property incorrectly, or you haven't set it and wtk.home either points to a wrong directory or a non-UEI compliant SDK. Your best bet is pointing wtk.midpapi directly to the MIDP library (usually classes.zip or midpapi.zip).

Some links you might find useful:
A working Antenna build file, and the related thread.

If you still have problems you might want to post the build file you're using.

shmoove
Hi Shmoove,

Thanks for the hints, but my buildfile is already based on that example and I have already read that thread! :P

I've echo'd my path for the ${wtk.midpapi} in the build.xml and it points to the correct place:

c:\WTK22\lib\midpapi10.jar

it is definitely pointing to midpapi.jar, but is that the right thing to point at?

I've also echo'd my ${wtk.home} and got this output:

c:\WTK22
which is exactly where the WTK is on my drive.

My device.properties file (nokia7210.properties) looks like this:

<!-- Nokia 7210 Phone -->deploy.directory=/builds/nokia7210/distdevice.name=nokia7210device.midp=midp1mmapi.sound=noSoundmmapi.music=noMusicwtk.cldc.version=1.0wtk.midp.version=1.0wtk.midpapi=${wtk.home}/lib/midpapi10.jarwtk.mmapi.enabled=falsewtk.bluetooth.enabled=falsewtk.java3d.enabled=falsewtk.device=Nokia_S40_DP20_SDK_1_1wtk.heapsize=1mresources.path=res/nokia7210


and my local.properties:
<!-- local properties -->wtk_home =C:/WTK22wtk_proguard_home=C:/proguard3.6/libant_home=C:/ant_1_6_5/binnokia_home=C:/nokiaantenna_lib=tools/bin/antenna-bin-0.9.13.jarbasedir=c:/mobile/midpjava_home=c:/j2sdk1.4.2_09


[Edited by - Multiverse on July 6, 2006 4:42:10 AM]
The properties look OK.

I think I know what your problem is.

The old WTK only had one file that contained all the VM classes (it was called midpapi.zip). In the newer version (post 2.1 I think), they separated the bootstrap classes into separate files: cldcapi10.jar, cldcapi11.jar, midpapi10.jar, midpapi20.jar, mmapi.jar, etc.
So now you have to include more than one file in the bootclasspath property, including all the libraries you're building for (ie, cldcapi10.jar, midpapi20.jar, and mmapi.jar if you're targatting a CLDC 1.0/MIDP 2.0 phone). So the wtk.midpapi file should reflect that.

shmoove
Brilliant!!

Thanks Shmoove, that worked like a charm! But I'd like to check a couple of things just to make what I've done won't cause me problems in the future. It works now, but maybe I havn't done it *quite* right.

Basically what I did was extract the midpapi10.jar, and the cldcapi10.jar, and then zipped the extracted folders into a single .zip file.

I named the zip file "midp1_cldc1.zip" and I was planning on creating similar ones for different configurations. For example "midp1_cldc1_1.zip" (containing midpapi10.jar and cldcapi20.jar)

would i be better off just creating 'one zip file to rule them all' containing all the api's I'm ever going to need? (and if i need a new one, i'll just add it to the zip) Which is similar to what was done in WTK < 2.1 from what i can gather.

Thanks again, your a lifesaver!
What you did should be alright. I don't expect any more problems.

A MIDP 2.0/CLDC 1.0 with all the extras (MMAPI, M3G, WMA, etc.) would be the the package to rule them all. Since there's backward compatibility you can compile any profile/configuration with that. The down side is that any MIDP version errors won't be caught during compilation.

You could also just use a colon separated list of the original libraries in wtk.midpapi:
wtk.midpapi=${wtk.home}/lib/midpapi10.jar:${wtk.home}/lib/cldcapi10.jar


shmoove
well in that case I think i'm going to use a colon seperated list for the wtk.midpapi property. I had read somewhere on the net ( here )that antenna wouldn't be able to interpret it and their advice was to put the api's you needed in a custom zip file. which is what i did, but shmoove to the rescue once again.

Lots of thanks once again.

This topic is closed to new replies.

Advertisement