• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in connecting floggy using j2me

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to J2me and floggy. I have included floggy-persistence-framework.jar in eclipseME buildpath. Still, I am also getting the same error. I saw the floggy FAQ. But, I am not able to change either of the lines from

Date dateIn = new Date(); // if I try to change Class.forname - it is giving error
Date dateOut = new Date(tfield.getString(), Integer.parseInt(tfieldN
.getString()));
to

Class personClass= Class.forName("Date");

In EclipseME it is showing, it is working in CLDC1.1 only. still no use.
Please kindly let me know the solution. thanks for your help.

Here are the programs

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

//import net.sourceforge.floggy.persistence.FloggyException;
import net.sourceforge.floggy.persistence.PersistableManager;

public class ExampleFloggy extends MIDlet implements CommandListener {

private TextField tfield;
private Command savecmd;
private Display display;
private Form form;
private TextField tfieldN;
private Command exitcmd;

public ExampleFloggy() {
System.out.println("inside constructor");
tfield = new TextField("name:", "", 15, TextField.ANY);
tfieldN = new TextField("age:", "0", 15, TextField.NUMERIC);
savecmd = new Command("save", "save file", Command.ITEM, 0);
exitcmd = new Command("exit","exit",Command.EXIT,1);
form = new Form("Floggy example.");
form.append(tfield);
form.append(tfieldN);
form.addCommand(savecmd);
form.addCommand(exitcmd);
form.setCommandListener(this);
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
notifyDestroyed();
}

protected void pauseApp() {
}

protected void startApp() throws MIDletStateChangeException {
System.out.println("inside startapp");
display = Display.getDisplay(this);
display.setCurrent(form);
}

public void commandAction(Command cmd, Displayable arg1) {
System.out.println("inside commandaction");
if (cmd == savecmd) {
Date dateOut = new Date(tfield.getString(), Integer.parseInt(tfieldN
.getString()));
int id;
try {
id = PersistableManager.getInstance().save(dateOut);
Date dateIn = new Date();
PersistableManager.getInstance().load(dateIn, id);
form.append(dateIn.toString());
} catch (Exception e) {
e.printStackTrace();
}

}else if (cmd==exitcmd){
try {
destroyApp(true);
} catch (MIDletStateChangeException e) {
e.printStackTrace();
}
}
}

}

########################################
import net.sourceforge.floggy.persistence.Persistable;

public class Date implements Persistable {

private String name;
private int age;
private transient int num;

public Date() {
}

public Date(String name, int age) {
this.name = name;
this.age = age;
}

public String toString() {
return "";
}
}


###################################
error
######################################

Running with locale: English_United States.1252
Running in the minimum security domain
java.lang.ClassNotFoundException: ExampleFloggy
at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Scheduler.schedule(+52)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
Execution completed.
3348452 bytecodes executed
20 thread switches
1667 classes in the system (including system classes)
17251 dynamic objects allocated (514248 bytes)
1 garbage collections (0 bytes collected)
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The problem seems not be on Floggy. EclipseME is trying to load your Midlet but it is not able to do that.
 
majety srikanth
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Thiago Moreira
Can you please tell me how can I remove this problem ? I configured this project in the usual way(adding third party reference jars ie. floggy persistance jar). In this case, it is giving classnotfoundexception for my midlet - ExampleFloggy.

If I use plugin development way ( i.e downloaded and pasted the floggy plugin jars in eclipse plugins folder, restarted eclipse), it is giving error. Even though the referenced library (i.e persistance jar) is showing the Persistable class in the package explorer view.

Running with locale: English_United States.1252
Running in the minimum security domain
java.lang.NoClassDefFoundError: net/sourceforge/floggy/persistence/Persistable
at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Scheduler.schedule(+52)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
Execution completed.
3407610 bytecodes executed
18 thread switches
1670 classes in the system (including system classes)
17722 dynamic objects allocated (534040 bytes)
3 garbage collections (460124 bytes collected)


Please help me out. I was trying to remove this error from last 3 days.
 
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
search on structure midlet.
what Thiago Moreira said is correct.
 
Thiago Moreira
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Try to run your application without the persistence code (Floggy). If that work okay than uncomment the Floggy code and test again. Keep in mind that to use Floggy on Eclipse you MUST install de plugin http://floggy.sourceforge.net/configuration/eclipse.html

Hope this helps
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic