aspose file tools*
The moose likes Java Micro Edition and the fly likes Basics for a new comer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Basics for a new comer" Watch "Basics for a new comer" New topic
Author

Basics for a new comer

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hi all,
Even though I am SCJP, I have no idea about J2ME programming. I want to try this one out as well.
So I have some problems. Could you please answer those. I have netBeans with me as the IDE. I have downloaded the wireless toolkit as well. I want to run a program. Atleast the "Hello world".

1) Where can I get the needed classes to write a mobile application.
2) Can I use netBeans to run the programs. If yes how can intergrate
those classes to netBeans.
3) How to run the program.
4) Can I transfer it to my real phone and check it. If yes how
Thank you very much for your time.


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Zia Ahmed Shaikh
Greenhorn

Joined: Apr 10, 2004
Posts: 2
Hi ;
To develop ur first J2me application you only have to perform few taska.
* click on KToolbar by selecting start menu > programs > J2me Wireless Toolkit > KToolbar.
* click NEW PROJECT
* give the name for ur project and click CREATE PROJECT.(there is no need of giving class name at this time if it is not available.)
* now a directory structure has been created automatically.
* place the following code in src folder of ur project (c:\wtk104\apps\YourProject\src\MyExample.java
*
//code starts
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener
{
private Display display;
private TextBox textBox;
private Command quitCommand;
public void startApp()
{
display = Display.getDisplay(this);
quitCommand = new Command("Quit",Command.SCREEN,1);
textBox = new TextBox("Hello World","My only first MIDlet",40,0);
textBox.addCommand(quitCommand);
textBox.setCommandListener(this);
display.setCurrent(textBox);
}
public void pauseApp(){
}
public void destroyApp(boolean uncontitional){
}
public void commandAction(Command choice,Displayable displayable)
{
if(choice==quitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
}

//*******program ends*******

* Now click on BUILD button on KToolbar window.
* To run the application press RUN button
enjoy it....
Email me if u face any problem or u need its explanation.
Your friend Zia.

ziaahmedshaikh@yahoo.com
Paulo Aquino
Ranch Hand

Joined: Apr 29, 2002
Posts: 200
Followed you're example...MyExample.java should be saved as HelloWorld.java
At the same time: I'm getting this exception:


Project settings saved

Building "Test"

Build complete

Running with storage root temp.DefaultColorPhone1087708151000

Unable to create MIDlet null

java.lang.NullPointerException

at com.sun.midp.midlet.MIDletState.createMIDlet(+14)

at com.sun.midp.midlet.Selector.run(+22)


Be Afraid...Be very Afraid...
Paulo Aquino
Ranch Hand

Joined: Apr 29, 2002
Posts: 200
anyone?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basics for a new comer