You must include the platform port before the LWUI

2020-02-15 01:35发布

问题:

I recently started using LWUIT. Great job and great program. I'm using Netbeans 6.9.1, S60 SDK and the webstart version of LCWUIT.

The first problem I faced was that I couldn't preverify Transitions3D.java file , however that was not an issue. I just removed that part of the code and recompiled the library from scratch. So I created a simple form with a "Hello World" Label and tried the "Create Netbeans Project" option of the resource editor. I did a Clean Build at the test_MIDP (where test is the name of my project) and tried to run it on the emulator. However I'm receiving this error message:

TRACE: <at java.lang.RuntimeException: You must include the platform port before the LWUIT in the classpath>, startApp threw an Exception
java.lang.RuntimeException: **You must include the platform port before the LWUIT in the classpath**
        at com.sun.lwuit.impl.ImplementationFactory.createImplementation(ImplementationFactory.java:67)
        at com.sun.lwuit.Display.init(Display.java:400)
        at userclasses.MainMIDlet.startApp(MainMIDlet.java:15)
        at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
        at com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
        at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
        at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
        at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
        at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
        at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
java.lang.RuntimeException: You must include the platform port before the LWUIT in the classpath
        at com.sun.lwuit.impl.ImplementationFactory.createImplementation(ImplementationFactory.java:67)
        at com.sun.lwuit.Display.init(Display.java:400)
        at userclasses.MainMIDlet.startApp(MainMIDlet.java:15)
        at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
        at com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
        at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
        at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
        at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
        at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
        at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

"You must include the platform port before the LWUIT in the classpath"

Any ideas on how to fix this error? I tried to run the MIDlet with both S60 and JavaME SDK 3.0 emulator and I received the same error.

StackOverflow warned me that there are similar questions however I couldn't find anything about related to my issue. If not please inform me.

回答1:

I shall answer my own post:

The problem was that in the UI jar I was including. LWUIT comes with 2 "sets" of UI.jar. The generic one which is in LWUIT\UI folder and the platform specific ones which are in the LWUIT\Ports folder.The generic one is being used as "parent" project containing all the common code,however if you MUST import the .jar file which is for your platform. As readme file says:

While these projects will compile easily they will be useless for any purpose since they don't include the binding glue for the platform, to use the platform one needs to use the appropriate projects underneath the specific ports directory to a given platform.

While I was recompiling the library in order to remove Transitions3D.java file, I recompiled (and then imported ) the generic UI.jar. The correct thing to do is compile, the parent project (the generic UI.jar) THEN compile the port specific library (in my case the LWUIT\ports\MIDP\UI.jar) and then import it in your project and you are done.