• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 614
  • Last Modified:

beginning with j2me

I am trying to build an application for a blackberry.  Can someone explain to me where to begin...I downloaded everything i need like de, cldc, midp....and i got the emulator to run.  I am just not sure how j2me differs from regular java.  I am not sure even what classes i can use.  The main part right now is that I need to read a text file (like maybe from an email being composed) in and then i will need to manipulate that.  Can someone help me out in where i should begin in creating this application?
  • 4
  • 4
2 Solutions
Well my first most important recommendation would be to make sure you know Java well and understand OOP.

>and i got the emulator to run

Personally I think that the Wireless Toolkit from Sun is the best emulator for J2ME, so if this isn't the emulator you already have, then check out this link...


> I am just not sure how j2me differs from regular java

The biggest difference would be that your obviosly targeting a platform that has far less resources than your regular java application. A standard java app will allow you to use around 50mg of memory.
Depending on which device your using, you may only be aloud to use a few tens of kilobytes of dynamic memory.

> I am not sure even what classes i can use.

First of all, you can't use the standard J2SE classes.
Although J2ME may have a String class, Random class and other classes very similar to J2SE, they are not always the same as the J2SE implementations.
To find exactly which classes you can use, check out this link...

http://jcp.org/aboutJava/communityprocess/final/jsr118/index.html  This is for MIDP 2.0
http://jcp.org/aboutJava/communityprocess/final/jsr037/index.html  This is for MIDP 1.0

>The main part right now is that I need to read a text file (like maybe from an email being composed) in and then i will need to manipulate that.
To find out which phone uses which version of MIDP, you'll need to check with the vendor.

For this, we'll need to know a bit more information. For example, where is the file comming from? A server?
If this is the case, you can use the javax.microedition.io.Connector class to open a connection the obtain the IO streams.
melissa555Author Commented:
thanks, sorry it took so long to get back to you.
That all helped lots.
For the last part, I will be needing to get the text that is being composed in an email.  If a person is using a blackberry and typing an email, I need them to be able to select an item from the menu (which i already figured out how to do) and then the function related to the menu item is going to need all of the stuff that they wrote in the email.  So is there a way to get all of the email text? or can you point me in the right direction? thanks
I'm not sure if I understand correctly.
Will the blackberry user be reading or writing the email?
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

melissa555Author Commented:
the blackberry user will be writing the email. the menu will have a function that will need the text from the email that the user is writing.
melissa555Author Commented:
actually i got that to work. i need to now read in a file, like a notepad document.  i need my application to get the words that are in a saved notepad document. do you know how to do this/
I'm not fimilar with the Blackberry file system however if you can manage to get an InputStream from the text file on the operating system, wrap an InputStreamReader around it and use a StringBuffer to append each character.


InputStreamReader inReader = new InputStreamReader(inputStream);
StringBuffer buffer = new StringBuffer();
int c = 0;

while ((c = inReader.read()) != -1)
  buffer.append((char) c);

Just be careful as to how much data you read because wireless devices usually have very limited memory.
melissa555Author Commented:
thanks, im just going to have to figure out how to specify the file i want

Your welcome :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now