Cell phones and java

J

john bailo

My boss just showed me the java logo coming up on his cell phone.

Cool.

Questions:

1) Can you recommend a tutorial for writing java apps for cell phones?

2) Are they applications or applets?

3) If I took a simple java applet and had him transfer it to his cell
phone, could he run it ?
 
L

Lothar Kimmeringer

1) Can you recommend a tutorial for writing java apps for cell phones?

start with the J2ME-pages of SUN. Download the WDK and read
the docs. This should give you a good start.
2) Are they applications or applets?
Midlets.

3) If I took a simple java applet and had him transfer it to his cell
phone, could he run it ?

No.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
J

John Bailo

Lothar said:

Not trying to be facetious -- but doesn't that violate the whole:

Write once, run anywhere principle?

Shouldn't a cell phone have the same java interpreter as any desktop OS?
 
M

Michael Borgwardt

John said:
Not trying to be facetious -- but doesn't that violate the whole:

Write once, run anywhere principle?

Not really, because it's "run anywhere with a Java platform conforming to
the same specification", and cell phones conform to J2ME, not J2SE.
Shouldn't a cell phone have the same java interpreter as any desktop OS?

Do you want your cell phone to be three times as big, have a third of the
battery life and cost ten times as much? If not, then it's simply not
technically feasible to have it support J2SE - maybe in 5 years this
will be different.
 
J

John Bailo

Michael said:
Not really, because it's "run anywhere with a Java platform conforming to
the same specification", and cell phones conform to J2ME, not J2SE.



Do you want your cell phone to be three times as big, have a third of the
battery life and cost ten times as much? If not, then it's simply not
technically feasible to have it support J2SE - maybe in 5 years this
will be different.

Well, ok.

I wrote ( or copied the code for ) a java applet that moves a ball
across the screen.

It's about 10 lines of code.

Are you telling me that this code, is so different on J2ME than J2EE ?

Why can't I just run it on J2ME ?
 
F

Frank Gerlach

John Bailo said:
Not trying to be facetious -- but doesn't that violate the whole:

Write once, run anywhere principle?
A mobile phone has much less recources than a PC. Because of this, the VM
and the librarys are a stripped-down version of the normal JDK/JRE
 
D

Darryl L. Pierce

john said:
My boss just showed me the java logo coming up on his cell phone.

Cool.

Questions:

1) Can you recommend a tutorial for writing java apps for cell phones?

Download Sun's Wireless Toolkit
<http://java.sun.com/products/j2mewtoolkit/download-2_2.html>. There are
two versions of the MIDP specification supported on phones currently:
1.0 and 2.0. You need to target the proper version of the specification
when writing a MIDlet.
2) Are they applications or applets?

Neither. They're MIDlets, they extend the class
javax.microedition.midlet.MIDlet.
3) If I took a simple java applet and had him transfer it to his cell
phone, could he run it ?

No. You have to write to the MID profile.
 
D

Darryl L. Pierce

Michael said:
Not really, because it's "run anywhere with a Java platform conforming to
the same specification", and cell phones conform to J2ME, not J2SE.

Technically, it's the KVM. J2ME is just an umbrella term referring to
all smaller-than-desktop technologies and not to any particular technology.
 
D

Darryl L. Pierce

John said:
I wrote ( or copied the code for ) a java applet that moves a ball
across the screen.

It's about 10 lines of code.

Are you telling me that this code, is so different on J2ME than J2EE ?

Why can't I just run it on J2ME ?

Because the APIs your 10 lines of code requires aren't available on a
mobile. The mobile is based on the Mobile Information Device Profile
which provides a small user interface API set in the
javax.microedition.lcdui package. Also, the application model is based
on the javax.microedition.midlet.MIDlet class which provides hooks for
receiving lifecycle calls from the Java environment on the handset.

Mobiles are a completely different beast from desktop computers, so why
would you assume that it would have the exact same Java runtime environment?
 
D

Darryl L. Pierce

Frank said:
A mobile phone has much less recources than a PC. Because of this, the VM
and the librarys are a stripped-down version of the normal JDK/JRE

Not really. The UI, communications and persistent storage APIs are
nothing like what's available in J2SE. The java.lang classes are
similar, as well as java.util, but otherwise the rest are custom
designed for wireless devices.
 
J

John Bailo

Darryl said:
Not really. The UI, communications and persistent storage APIs are
nothing like what's available in J2SE. The java.lang classes are
similar, as well as java.util, but otherwise the rest are custom
designed for wireless devices.


I still Object.

I wrote an applet that moves a ball across a screen.

It uses the paint method.

Shouldn't the paint method, and applet init() and so on be transparent
across all platforms?

A cellphone has a processor and a screen and a "keyboard".

It's a small computer.

It should work *exactly* the same on a cell phone.

Yes, there may be a subset of the Java API on the cell phone, but not a
radically different thing.

I bet what they are doing is actually compiling a Java app to an
executable that has nothing to do with the bytecode intepretation
principles of java.
 
D

Darryl L. Pierce

John said:
I still Object.

You can do so. However, your objection makes no difference. The facts
are that the APIs you're using are not available on mobiles. There is
AWT and no Swing which are the APIs you used.
I wrote an applet that moves a ball across a screen.
Yeah?

It uses the paint method.

Of what class?
Shouldn't the paint method, and applet init() and so on be transparent
across all platforms?

No, since applets are not supported on anything but web browsers.
A cellphone has a processor and a screen and a "keyboard".

No, it does not have a keyboard. It has a UTI-9 keyPAD. When you put the
word keyboard into quotes you should have realized your mistake.
It's a small computer.

So is the remote control for my digital cable box. Should it also run
your bouncing ball applet?
It should work *exactly* the same on a cell phone.
Why?

Yes, there may be a subset of the Java API on the cell phone, but not a
radically different thing.

That it's even slightly different makes a difference. Your application
wrote to APIs that are *non-existant* on mobile devices.
I bet what they are doing is actually compiling a Java app to an
executable that has nothing to do with the bytecode intepretation
principles of java.

No, "they" aren't. They're executing a ROMized image of the MIDlet suite
in the K virtual machine on the mobile.
 
J

John Bailo

Darryl said:
John Bailo wrote:

You can do so. However, your objection makes no difference.

Of course, because Sun is another Microsoft in wolf's clothing.
The facts
are that the APIs you're using are not available on mobiles.

I wrote it once. It doesn't run everywhere.

What happened?
Of what class?


No, since applets are not supported on anything but web browsers.

So they are useless.
No, it does not have a keyboard. It has a UTI-9 keyPAD. When you put the
word keyboard into quotes you should have realized your mistake.

But it should be the job of java to virtualize it -- right ?
So is the remote control for my digital cable box. Should it also run
your bouncing ball applet?

YES! That's the whole raison d'etre of java !!!!
No, "they" aren't. They're executing a ROMized image of the MIDlet suite
in the K virtual machine on the mobile.

So it's not really java.

It's something else, and they call it java to get the brand name
recognition.
 
D

Darryl L. Pierce

John said:
Of course, because Sun is another Microsoft in wolf's clothing.

Yep. It's all a conspiracy to...what, exactly?
I wrote it once. It doesn't run everywhere.

What happened?

Do you understand what "everywhere" means in the context of WORA? Can
your code run on any instance of the HotSpot JVM?

You seemed to have missed this question.
So they are useless.

They seem quite useful *on web browsers*.
But it should be the job of java to virtualize it -- right ?
No.


YES! That's the whole raison d'etre of java !!!!

No, it's not. Java was not meant to have every Java application run on
every device that runs a form of Java. Do you expect to run EJBs and
servlets on mobiles as well?
So it's not really java.

How do you figure? Perhaps you should first explain what *you* mean by
"Java" so we can determine whether or not mobile devices conform to that
definition.
It's something else, and they call it java to get the brand name
recognition.

Java is a programming language. You use that programming language to
write applications for mobile devices that have the MIDP. There are
standard APIs for the MIDP and those APIs are implemented in the Java
language. You achieve Write Once Run Anywhere ability when you write to
the MIDP specification and them load your application on a MIDP enabled
device. That you can take a desktop application and load *that* onto a
cell phone does not show that WORA wasn't achieved; it shows that you
don't understand what WORA implies.
 
D

Darryl L. Pierce

Darryl said:
That you can take a desktop application and load *that* onto a
cell phone does not show that WORA wasn't achieved; it shows that you
don't understand what WORA implies.

This should read "That you *can't* take a desktop application..."
 
J

John Bailo

Darryl said:
Mobiles are a completely different beast from desktop computers, so why
would you assume that it would have the exact same Java runtime
environment?

Well, I guess James Goesling isn't much of an engineer.

That's all I can say.
 
L

Lothar Kimmeringer

Of course, because Sun is another Microsoft in wolf's clothing.

Their intend is to earn money, so you're right in some way.
But that's every company we see on this earth.
I wrote it once. It doesn't run everywhere.

What happened?

You did something wrong.
So they are useless.

I'm writing server-applications and programs for mobile devices,
so you're right for me. If you write normal applications, you
don't use Applets, either. Applets are

"An applet is a small program that is intended not to be
run on its own, but rather to be embedded inside another
application."

(taken from the Java-API) So Applets are something special you
only use in special environments.
But it should be the job of java to virtualize it -- right ?

It does it well. For a Java-application on a mobile device it
doesn't matter if the entered text is coming from a keyboard,
a keypad or a touchpad with OCR. The underlying hardware
is completely different to each other, on the Java-side the
code can be written once and runs on every J2ME-enabled mobile
device. In fact I was writing applications, that are running
on a Nokia 6310i and on a Blackberry without any change.
YES! That's the whole raison d'etre of java !!!!

Obviously you're the only one thinking so (maybe together with
some marketing-guys at Intel who are thinking of how to sell
more Pentiums). Of course it would be nice to be able to write
one application that is running on every single device being
developed in past and in the future, but the real life is
different to that and for a mobile device it would just be
impossible to provide that because of the restrictions it brings.
So it's not really java.

Java is a programming language and a plattform. The programming
language is always the same, the platform is different. J2SE and
J2ME are different ones and therefore there can be differences
in programming.

BTW. You can program a LEGO Mindstorms roboter with Java as well.
How do you suppose should be your bouncing ball applet run on
that. A bouncing roboter?
It's something else, and they call it java to get the brand name
recognition.

No.

What's this thread about anyway? Where you promising to somebody
to write an application for a mobile phone thinking it will be
enough to implement an applet now all was useless and you
don't get payed and are angry about that, or what?


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 

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,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top