Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

J2ME and JAR creation

Status
Not open for further replies.

skarosi

Programmer
Jan 25, 2004
140
0
0
GR
Hi all,
I am quite new to the J2ME enviroment, i actually just did my first hello world aplication.
I am working on the wireless toolkit from sun and i was wantering how is it possible to load this application to my mobile phone? do i have to create a jar file? if yes how?
thanks a lot
ilias
 
Yes you have to create a JAR and a JAD file,load up these to your phone and then install the JAD.

When using the wireless toolkit you create these files - see: "The bin directory contains the compiled MIDlet suite (a .jar file) and the MIDlet suite descriptor (a .jad file)" in the link:
You copy the JAR and JAD files onto your phone by one of these methods:
1) bluetoothing both files from your PC to the phone
2) downloading from your PC via a USB cable to the phone
3) uploading these files to a web site and via the phone's browser downloading to the phone.

Install your "HelloWorld" application by opening the JAD file which in turns installs the JAR file. If you have a problem with the JAD you can install using the JAR. You might have to change the settings on your phone to allow installing without a certificate - it will prompt you to ask if you want to install from this untrusted source.

If you have seen it then Netbeans 5.5 IDE is excellent for creating J2ME midlets: You also add to this:
 
The problem is that i can find how i can create the Jad file. I figured out how to make the jar, i did it and sent it to my nokia phone, but it says that it is an invalid application.
would u have any idea why?
thanks
 
Invalid file is common - often due to:
1) you are trying to install an unsigned application when your phone options dictate only signed - ie with certificate. Change your phone options to allow unsigned applications.
2) Your midlet or any associated images are too big - depends on the phone
3) a bluetoothed JAD/JAR file gets corrupted - I found sometimes that a bluetoothed JAD/JAR (in my case from linux using OBEX) throws this message. Solution is to transfer the JAD/JAR by USB cable.

some questions:
What phone are you using?
How big is your midlet?
 
I tried it with two phones, Nokia 5200 and Nokia 6600, both using bluetooth, since i dont have a cable.
The program is prety small, just the helloworld example. that is 1,42KB.

Do you know a good site that i can find out about the commands? I want to start making programs of my own, just to learn it, but i have no idea of the commands. for example, how can i read something from the keyboard?

thanks
 
Have a look at this J2ME tutorial which shows you how to handle the user interface:

JAD file
Netbeans IDE 5.5 creates a JAD automatically alongside the JAR or you can create a JAD manually in an editor, see:

here's an example:
MIDlet-Name: MyFirst
MIDlet-Version: 1.0.0
MIDlet-Vendor: Sun Microsystems, Inc.
MIDlet-Description: My First MIDlet
MIDlet-Info-URL: MIDlet-Jar-URL: first.jar
MIDlet-Jar-Size: 1063
MicroEdition-Profile: MIDP-1.0
MicroEdition-Configuration: CLDC-1.0
MIDlet-1: MyFirst,, FirstMIDlet


Your JAR size is small so no problem there.


You can check out your phones at:

I notice that Nokia 5200 is MIDP 2.0 CLDC 1.1 while Nokia 6600 is MIDP 2.0 though CLDC 1.0 - your JAD and manifest within the JAR needs to reflect these.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top