1

I just downloaded the Java ME Platform SDK 3.0 and created my frist Midlet (from some Oracle Tutorial). Which works fine on the Emulator. When I deploy it on my Nokia N97 I can run it but as soon that I press "Connect" and allow to proceed I get a IOException: -1

Here is the code:

package hello;
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloMIDlet extends MIDlet implements CommandListener {

...

private void connect() {

HttpConnection hc = null;
InputStream in = null;
String url = getAppProperty("HitMIDlet.URL");

try {
  hc = (HttpConnection)Connector.open("http://www.google.ch"); 
  in = hc.openInputStream();
  byte[] raw = new byte[10];
  int length = in.read(raw);
  in.close();
  hc.close();

  // Show the response to the user.
  String s = new String(raw, 0, length);
  mMessageItem.setText(s);

}
catch (IOException ioe) {
  mMessageItem.setText( ioe.toString());
}
mDisplay.setCurrent(mMainForm);
}
}
Lucifer
  • 29,392
  • 25
  • 90
  • 143
Marcel Menz
  • 1,075
  • 7
  • 17
  • 25

1 Answers1

2

You have working GPRS or internet connectivity in your phone + for your application ?

In many phone we have to set access point for app differently double check it

jmj
  • 237,923
  • 42
  • 401
  • 438