• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java classes and J2ME classes

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there
I've recently written a program in "normal" Java, just to get the feel for it.
However my real aim is to write the program so it runs on a mobile.

My problem is, and I feared as much, when I simply copy and paste the code from a standard Java project/package to the J2ME project it can't find most of the classes.

My program uses the following classes:

import java.lang.System.out;
import java.util.Scanner;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;
import java.io.LineNumberReader;



But with the exception of the IOException the Micro Edition can't find any of them.

How do I find out what their equivalents are (if there are any)?
It is important for me to read in a file (io.File), count the lines (io.LineNumber.Reader), turn the contents into an array of arrays(util.ArrayList), display one of the array items (System.out), get user input (util.Scanner).

For example is there a Micro Edition class = io.LineNumberReader?
Or am I going to have to reinvent the wheel?

Thanks very much in advance.

Dan
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
J2ME is their own subset of APIs. Some are just simpler versions of the J2SE, but no IO classes. It has the Generic Connection Framework to get connections, and not all devices will implement all the possible types of Connection objects.

For use input you use the J2ME microedition lcdui package to create a TextField.

If you haven't done so yet, download the Wireless Toolkit from Sun, and in that installation is the JavaDocs for the J2ME APIs, go into MIDP and see what you have and what you don't.

J2Se and J2ME are two different paradigms.

Mark
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I reccomend you to think two APIs different and work on them separately (possibily in parallel). Here is a link to get started:

Getting Started with Java ME
http://www.java-tips.org/content/view/95/39/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic