Posted By:
david_beaumont
Posted On:
Tuesday, September 6, 2005 07:39 AM
There seem to be two related things th;at you might wish to consider here (I have just this minute figured out how to get my stuff working in the way you describe).
Firstly, I am using kxml2-min.jar which I downloaded as part of the kxml distribution. All I needed to do was select my destination project, right click, and go to:
Build Path
-> Configure Build Path
-> Libraries
-> Add external JARs
From there, select the JAR file via the browser (I first copied it to a new subdirectory inside the eclipse directory to make sure it didn't suffer if I moved the kxml distribution).
Now go to the "Order and Export" tab (in the same Build Path dialog) and select the JAR if it's not already selected. This allows the JAR to be exported to the MIDlet packaging stage (if the JAR was already installed on the device then you wouldn't need to do this stage).
This completely avoids the need to have kxml as a source based project in eclipse.
Secondly (the bit that caused me issues) was trying to do what you're doing, which is link a 'library' project into a 'MIDlet' project. If the compiler can see the library project but it fails at runtime (as you seem to be describing) then try this:
Right click on the library project and go to:
J2ME
-> Create Package
Now you should have a 'deployed' directory in the library package.
Now right click the MIDlet project and go to:
Build Path
-> Configure Build Path
-> Libraries
-> Add JARs
This should let you browse to the deployed directory in the library project where you can select the library JAR.
Now, as before, you go to the "Order and Export" tab and make sure the JAR is selected.
The only odd thing here is that the "Order and Export" tab now shows two entries for the library project: one because we have included the project as a dependency for compiling (this should not need to be ticked) and one because we included the JAR (this should be ticked).
If anyone can suggest a neater way to do this that uses the library project directly, rather than the deployed JARs, please let me (us) know.