Hello everybody,
I am new to this subject. I am doing a development for one of my classes. I need to write an sms application (with Java) that sends a SMS. The user will write the SMS, and it will be send with what the user has written and some extra words that the application will add. I have developed with eclipse and eclipseME an example. It runs fine there, but when trying to install on my Nokia E61 says invalid jar! I am new, and don't know what could be happening. If anyone could help me, I would really appreciate. I am writting here the jar I export from eclipse.
Thanks a lot,
Jordi
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.io.Connector;
import javax.microedition.lcdui.*;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;
public class Demo extends MIDlet implements CommandListener {
Alert alerta1, alerta2;
Command enviar,salir, aler1, aler2;
Displayable temp;
Display pantalla;
Form pantallainicial;
TextField telefono ;
TextField mensaje ;
public Demo(){
// Obtengo la referencia a la pantalla del MIDlet
pantalla = Display.getDisplay(this);
// Creo los objetos que forman las pantallas del MIDlet
salir = new Command("Salir",Command.EXIT,1);
enviar = new Command("Enviar",Command.OK,1);
/*aler1 = new Command("Alerta Modal",Command.SCREEN,1);
aler2 = new Command("Alerta No Modal",Command.SCREEN,1);*/
telefono = new TextField ("Numero Telefonico", "", 11, TextField.PHONENUMBER);
mensaje = new TextField("Mensaje","",120,TextField.ANY);
// Creo la pantalla de alerta 1
/*alerta1 = new Alert("Alerta Modal","Esta alerta desaparecer?"+
"cuando pulses el bot?n de aceptar", null, AlertType.INFO);
// Creo la pantalla de alerta 2
alerta2 = new Alert("Alerta No Modal","Esta alerta desaparecera cuando pasen 5 segundos",null,AlertType.INFO);
alerta1.setTimeout(Alert.FOREVER);
alerta2.setTimeout(5000);*/
// Creo la pantalla principal del MIDlet
pantallainicial = new Form("Jordi Demo");
pantallainicial.append(telefono);
pantallainicial.append(mensaje);
// Inserto objetos en la pantalla
pantallainicial.addCommand(salir);
pantallainicial.addCommand(enviar);
/*pantallainicial.addCommand(aler1);
pantallainicial.addCommand(aler2);*/
pantallainicial.setCommandListener(this);
} public void startApp() {
pantalla.setCurrent(pantallainicial);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == salir) {
destroyApp(false);
notifyDestroyed();
} else if (c == enviar) {
try {
MessageConnection mc = (MessageConnection)Connector.open("sms://+"+telefono);
TextMessage msg = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE);
msg.setPayloadText(mensaje.getString());
mc.send(msg);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

Reply With Quote
","Ocurrio un Error", null, AlertType.INFO);


