Skip to main content

example with MHP and LWUIT, i don't know the problem :(

3 replies [Last post]
isuchi
Offline
Joined: 2010-06-04

I'm trying a very simple example in mhp using LWUIT, but i have a problem and i don't know how fix it... Could someone help me?

This is my example:

import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;
import javax.tv.xlet.XletStateChangeException;

import com.sun.lwuit.Command;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;

public class HelloLWUIT implements Xlet, ActionListener {

private static XletContext xletContext;

public HelloLWUIT(){}

public void actionPerformed(ActionEvent ae) {
notifyDestroyed();
}

private void notifyDestroyed() {
// TODO Auto-generated method stub

}

public void destroyXlet(boolean unconditional)
throws XletStateChangeException {
// TODO Auto-generated method stub

}

public void initXlet(XletContext ctx) throws XletStateChangeException {
System.out.println("Starting... ");
xletContext = ctx;
}

public void pauseXlet() {
// TODO Auto-generated method stub
}

public void startXlet() throws XletStateChangeException {
System.out.println("from Start Xlet method...");
Display.init(this);
Form f = new Form("Hello, LWUIT!");
f.show();

Command exitCommand = new Command("Exit");
f.addCommand(exitCommand);
f.setCommandListener(this);

}
}

=============================
And the answer is:

java.lang.NoClassDefFoundError: Error reading file for class: com.sun.lwuit.events.ActionListener
at java.lang.Class.loadSuperClasses()V(Unknown Source)
at java.lang.ClassLoader.defineClass(Ljava/lang/String;[BIILjava/security/ProtectionDomain;)Ljava/lang/Class;(Unknown Source)
at com.adb.java.lang.FileClassLoader.readFromFile(Ljava/io/File;)Ljava/lang/Class;(Unknown Source)
at com.adb.java.lang.FileClassLoader.loadClass(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/Class;(Unknown Source)
at com.adb.java.lang.FileClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class;(Unknown Source)
at java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class;(Unknown Source)
at tv.osmosys.application.AppManager$XletApp.xletLoad()Z(Unknown Source)
at tv.osmosys.application.AppManager$XletApp.processAction(Ltv/osmosys/application/AppManager$XletAction;)V(Unknown Source)
at tv.osmosys.application.AppManager$XletApp.run()V(Unknown Source)
at java.lang.Thread.run()V(Unknown Source)
at java.lang.Thread.startup(Z)V(Unknown Source)

=================================================
Thanks for ur time and help

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
earwen2
Offline
Joined: 2010-06-07

I have a problem with this example also. The asnwer is about some problem with display... Any idea???

chihiro_saito
Offline
Joined: 2006-11-08

lwuit is not a part of the BD-J platform classes, so one will have to bundle the com.sun.lwuit.* classes in the application .jar file to use them...

earwen2
Offline
Joined: 2010-06-07

It's working now!!!
Thank u for everything!