The latest version of Eclipse can be downloaded here: http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.1.1-200509290840/eclipse-SDK-3.1.1-win32.zip
Then download the latest SDK from: http://www.motocoder.com/motorola/download.jsp?FILENAME=downloads/files/SDK542.zip
Install this SDK to your windows system in the default directory (makes later steps much easier!)
Install EclipseME with these instructions: http://eclipseme.org/docs/installEclipseME.html
Configure EclipseME with these instructions: http://eclipseme.org/docs/configuring.html
Make sure you phone is in USB Mass Storage mode by going to the main menu, set up, usb mode and choosing "mass storage." Select "save" to exit out of the settings. Your phone will now mount as a USB hard drive when plugged into your computer.
Plug in your phone and open up a file explorer window with the newly mounted drive. Copy the jad and jar files from the deployed folder of your project to the drive. Wait a few seconds and then unplug your phone. The files are now in the flash file system of the phone.
Navigate to the folder that you saved the files to on your phone by going to the main menu and opening the "files" application. Click once on the jad file (NOT the jar file) to install the application. Say ok to any dialogs that may appear and choose the main menu group that you want the shortcut to your new application to appear in.
You may now launch your application from the main menu by clicking on its icon.
Note: Since you don't have a debugging console when you are running applications on the phone, it is recommended that you catch all exceptions and call the following method with the toString() of your exception:
public void displayException(String e) {
Alert a = new Alert("error:",e,null,AlertType.ERROR);
a.setTimeout(Alert.FOREVER);
myDisplay.setCurrent(a,titleScreen);
}
The following are common permissions:
StringBuffer s = new StringBuffer();
HttpConnection c = (HttpConnection)Connector.open("http://web.mit.edu/index.html");
InputStream is = c.openInputStream();
byte b;
while ((b = (byte)is.read()) != -1) {
s.append((char)b);
}
is.close();
c.close();
Permissions needed: javax.microedition.io.Connector.http
FileConnection sc = (FileConnection)Connector.open("file:///phone/tmp.txt");
OutputStream os = sc.openOutputStream();
os.write(("text to go into the file").getBytes());
os.flush();
os.close();
Permissions needed: com.motorola.file.writeaccess
FileConnection sc = (FileConnection)Connector.open("file:///phone/tmp.txt");
InputStream is = sc.openInputStream();
StringBuffer sofar = new StringBuffer();
byte c;
while ((c = (byte)is.read()) != -1){
sofar.append((char)c);
}
is.close();
Permissions needed: com.motorola.file.readaccess
sender = (MessageConnection)Connector.open("sms://");
TextMessage t = (TextMessage)sender.newMessage(MessageConnection.TEXT_MESSAGE);
t.setPayloadText(message);
t.setAddress("sms://" + contactNumber);
sender.send(t);
Permissions needed: javax.wireless.messaging.sms.send
Permissions needed: javax.wireless.messaging.sms.receive
LocationProvider loc = LocationProvider.getInstance(null);
loc.setLocationListener(ll,0,-1,-1);
Location location = loc.getLocation(60*3);
String lat = location.getQualifiedCoordinates().getLatitude();
String lon = location.getQualifiedCoordinates().getLongitude();
Permissions needed: javax.microedition.location.Location
String cellID = System.getProperty("phone.cid");
Permissions needed: none
Dialer dialer = Dialer.getDefaultDialer();
dialer.startCall("6172531000");
Permissions needed: com.motorola.phone