(J2ME)Sun Java Mobility Studio. 6 Early Access (aka Beta)

J

JamesMason

If you're a J2ME developer you must download this and try it out.
Having tested out JBuilder, IBM's WebSphere (Device Developer Edition)
as well as Forte, I can say Mobility Studio is the way to go.

It goes beyond subjective when you look at the device profiler and
Memory Monitor tools (not to mention step-through debugging). This IDE
is a real jewel.

The downfall is that it's still a beta product, so it's not the most
stable IDE you can run (I'd have to give that award to IBM's
WebSphere, but the extra features are incredibly nice. Want to support
Mobile Media APIs? Wnat to support Web Services or Wireless Messaging
API? These things can be turned on/off though project config check
boxes (same applied to MIDP 1.0 and 2.0 implementations).

I am having a problem with this IDE if anyone can help. 1. I can't
figure out how to compile my classes into a JAR file though the IDE.
2. I can't figure out how to include resources. I've tried creating a
res directory under the mounted subfolder and my app still can not
locate the image I'm trying to load. This same app works fine under
KToolBar so I know it's the IDE doing something strange.

-James
 
J

JScoobyCed

JamesMason said:
1. I can't
figure out how to compile my classes into a JAR file though the IDE.
2. I can't figure out how to include resources. I've tried creating a
res directory under the mounted subfolder and my app still can not
locate the image I'm trying to load. This same app works fine under
KToolBar so I know it's the IDE doing something strange.

-James

Hi,

I have downloaded it and installed. It looks nice. I think for JAR,
use the JAR packager wizard (it is similar in Eclipse). For that, go to
File/New/JAR archive/JAR recipes and then follow the wizard.
For resources I dunno yet. I can't compile...
In fact my code needs the bluetooth.zip library. I have it, but I can't
find where to include it so the compiler will do the job. But I just
installed 5 minutes ago, I'll read the Getting started and Examples first.
 
W

William Tores

Complete and utter crap. Want an example? See my code sniplet below. I have
a very bare-bones MIDP 1.0 application here that attempts to make an
HttpConnection and download a text file.

How does Suns Mobility Studio handle this? It doesn't. When I run it, the
IDE compiles the code just fine when it executes the Sun default Color Phone
emulator appears for a few seconds then goes away, the output window
displays the following:

5 thread switches
485 classes in the system (including system classes)
2048 dynamic objects allocated (59256 bytes)
1 garbage collections (0 bytes collected).

When I run the profiler again, nothing. Worthless software from a worthless
company. Regardless of how much we may hate Microsoft, I will say this
Visual Studio.NET is a damn good IDE and once you've been spoiled to it it's
very hard to tolerate other IDE's that refuse to at least meet the standard.
To be fair Sun's Mobility Studio does exceed VS.NET is some important areas,
however when it comes to very stream lined execution the software (even in
late beta) should not crash like this. It's shameful to the vendor, it's
shameful to the engineers who developed it, they should all be held
accountable and I believe that day is approaching (one only has to look at
Sun's decline over the past few years, I doubt they last another two.. the
eventual demise will be justice in a way). It's very hard to feel sympathy
for this company and I can't express how frustrating it is to use a product
that's almost there. Half ass is probably the best term to describe it.










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

/**
* An example MIDlet with simple "Hello" text and an Exit command.
* Refer to the startApp, pauseApp, and destroyApp
* methods so see how each handles the requested transition.
*
* @author Jeremy Deats
* @version
*/
public class HELLO extends MIDlet implements CommandListener {

private Command exitCommand; // The exit command
private Command aexitCommand; // The exit command
private Display display; // The display for this MIDlet
// private GameCanvas screen;
private Form screen;

private StringItem txt;

public HELLO() {
display = Display.getDisplay(this);
exitCommand = new Command("Exit", Command.SCREEN, 2);
aexitCommand = new Command("Test", Command.SCREEN, 2);

txt = new StringItem("test", "1");
screen = new Form("Form1");

}

/**
* Start up the Hello MIDlet by creating the TextBox and associating
* the exit command and listener.
*/
public void startApp() {

screen.append(txt);

screen.addCommand(exitCommand);
screen.addCommand(aexitCommand);
screen.setCommandListener(this);
String rst = HTTPGet();
StringItem txt1 = new StringItem("test:", rst);
screen.append(txt1);
display.setCurrent(screen);
}

/**
* Pause is a no-op since there are no background activities or
* record stores that need to be closed.
*/
public void pauseApp() {
}

/**
* Destroy must cleanup everything not handled by the garbage collector.
* In this case there is nothing to cleanup.
*/
public void destroyApp(boolean unconditional) {
}

/*
* Respond to commands, including exit
* On the exit command, cleanup and notify that the MIDlet has been
destroyed.
*/
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}

if (c == aexitCommand)
{

}
}

private String GetS()
{
String rtn = "test111";
return rtn;
}

private String HTTPGet() {
HttpConnection conn = null;
String tmp = "";
InputStream in = null;
StringBuffer data = new StringBuffer();
String rtn = "";

try {
// Open the HTTP connection
// conn.setRequestMethod(HttpConnection.GET);
conn =
(HttpConnection)Connector.open("http://127.0.0.1/test/test1.txt");


// Obtain an input stream for the connection
in = conn.openInputStream();

// Read a line at a time from the input stream
int ch;
while ((ch = in.read()) != -1) {
if (ch != '\n') {
// tmp = "a";
// Read the line a character at a time
data.append((char)ch);
}
}

}
catch (IOException e) {
// ... write out execption though alert (omited)
rtn = e.getMessage();
}

if (data.length() > 0)
{
rtn = data.toString();
}

return rtn;
}

}
 
S

Steven J Sobol

JamesMason said:
If you're a J2ME developer you must download this and try it out.
Having tested out JBuilder, IBM's WebSphere (Device Developer Edition)
as well as Forte, I can say Mobility Studio is the way to go.

If it has as many memory leaks as Netbeans has, I don't want to touch it.
I've had constant problems with Netbeans 3.6. I am rather disappointed with
the product. Netbeans being a resource hog is one thing, but... jeesh. Does
Mobility Studio do any better than Netbeans does?
 
D

Darryl L. Pierce

William said:
Complete and utter crap. Want an example? See my code sniplet below. I
have a very bare-bones MIDP 1.0 application here that attempts to make an
HttpConnection and download a text file.

You simple MIDlet is poorly coded.
/**
* Start up the Hello MIDlet by creating the TextBox and associating
* the exit command and listener.
*/
public void startApp() {

screen.append(txt);

screen.addCommand(exitCommand);
screen.addCommand(aexitCommand);
screen.setCommandListener(this);
String rst = HTTPGet();


This is *BAD*. You're attempting to execute the networking code *on the main
thread*. Of *course* it blows up, you've trashed the VM by tying up the
main thread with networking functionality. If you read the APIs for the
lifecycle methods (startApp(), pauseApp(), destroyApp(boolean)) you'll see
that these methods *must* return quickly. To do networking, you have to
spawn a *separate* thread to do so.

I'm not defending Studio. But, your example is a poor one. It would crash on
a real device in the same manner that it crashes in Sun's emulator.
 
W

William Tores

Darryl L. Pierce said:
You simple MIDlet is poorly coded.


This is *BAD*. You're attempting to execute the networking code *on the main
thread*. Of *course* it blows up, you've trashed the VM by tying up the
main thread with networking functionality. If you read the APIs for the
lifecycle methods (startApp(), pauseApp(), destroyApp(boolean)) you'll see
that these methods *must* return quickly. To do networking, you have to
spawn a *separate* thread to do so.

Thank you for the feedback, the code I'm referencing is actually adapted
from a sample in "Teach Yourself J2ME Programming in 21 Days" by Sams Press.
The code sample in the book does not make use of a separate thread to
instantiate HttpConnection. I'm not saying the book is correct, spawing it
off in the seperate threads makes since. It's just my example was poor.

Still, I hold to my belief that the emulator should not crash the way it
did.

-Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top