View Full Version : Beginner Step by Step
I've been trying to create applcations for 3510i since january but i never succseeded.
I made applications that WORKED on 3510i EMULATOR FROM NOKIA.COM, but they never worked uploaded on the phone (application not supported).
So PLEASE, help me, and TELL me all the steps i need to do having the source (a simple HELLO WORLD APP) COMPILED AND uploaded to my mobile.
Thank you.
Hi SKIL,
you need to...
1. create the application (write a MIDlet)
2. compile the code
3. preverify the code
4. package the code
5. create the appropriate JAD file
You don't have to do these steps yourself (apart from the first one ;-), some tools are out there to help you.
<ShamelessAdvertising>
check out J2ME Polish,
http://www.j2mepolish.org
This tool not only does the steps 2-5 automatically for you, but it also helps to adjust the application to all devices and more (like designing the application with CSS). The distribution of J2ME Polish contains an example MIDlet to get you going as well.
</ShamelessAdvertising>
Oh, I almost forgot the last step: deploy the application on the phone, this can be either done via OTA download (be sure to set the Mime Type for JAD-files correctly at the webserver) or via infrared, bluetooth, or USB. I don't own a 3510i, but OTA download works with all J2ME phones.
Hope this helps,
- Robert
Thank you for your reply. The J2polish is some files, no EXE. I've downloaded eclipse3, but how can i integrate jpolish into it? I cannot understand the install.txt
Thank you.
Are you making sure you're building MIDP 1.0 applications and not MIDP 2.0 applications? Look in the jad file and check that the MicroEdition Profile attribute is 1.0.
shmoove
Hi Skil,
thanks I will try to make the installation instructions a bit more clear. More information is at the website (documentation -> install, http://www.j2mepolish.org/docs/install.html ).
To integrate J2ME Polish into eclipse it is best to create a new folder in your workspace called "myproject" and to extract the J2ME Polish zip file into it. Then go into eclipse and create a new project called "myproject". Eclipse should then integrate the files automatically. You need to adjust the ClassPath or the new project then:
Select the project, right click, select "properties" and go to the "Java Build Path". Go to the "Libraries" tab -> "Add Jars..." and include the file workspace/myproject/import/midp1.jar.
Then open the file "build.xml" (which is in the root of your project) and adjust the "preverify"-attribute of the J2ME Polish task in it. Also do change the deviceRequirements from "Nokia/N-Gage" to a "Generic-midp1".
You can now create the JAR and JAD by right-clicking the build.xml file, selecting "Run Ant" and running ant in the next dialog.
You will find the JAR and JAD then in the "dist" folder of the project.
I hope this explanation was easier to follow. Please get in touch when you feel it needs to be improved.
Cheers,
Robert
Sorry :(, it's too hard for me to understand! There are so many software to create a little 35k mobile application :(. The integration failed, in the JAD file i have MIDP1.0, BUT MY MOBILE SAYS APPLICATION NOT SUPPORTED. What can i do?
Hi Skil,
send me your email-address to "robert at enough.de", I will then send you a working example for your 3510i, you can move along from there then.
In turn please help me to create an easy to follow instruction for beginners, okay?! Tell me what parts you find hard to follow and what exactly failed - best via email.
Best regards,
Robert
alex_crowther
2004-05-30, 04:12
If you are just starting out, don't bother with a GUI.
I have found that J2ME GUI's fail in the basic task of
being easier than the command line.
I have included a super simple project and the windows bat file that would compile it.
Tested on a 6610 and worked:
/*--------------------------------------------------
* MyFirstWorking.java
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MyFirstWorking extends MIDlet
{
private Display display = null;
// A required method
public MyFirstWorking(){}
// A required method
public void startApp()
{
display = Display.getDisplay(this);
display.setCurrent(new TextBox("TextBox", "Yer Baby", 50, 0));
}
// A required method
public void pauseApp() { }
// A required method
public void destroyApp(boolean unconditional) { }
}
And the bat file to compile it:
@ECHO off
rem | |
rem ---+---------------------------------------------+---
rem ---| Settings you need to change. |---
rem ---| Check each one is correct for your compuler |---
rem ---+---------------------------------------------+---
rem | |
rem - name of your project - note this example is limited to 1 file
rem - this is the name of your class and of your .java file.
set PROG=MyFirstWorking
rem - location of compiler javac.exe and jar.exe
set JAVABIN_LOC=C:\java\jdk1.3.1_09\bin\
rem - location of preverify.exe
set PREVERIFY_LOC=C:\nokia\devices\Nokia_7210_MIDP_SDK_v1_0\bin\
rem - location of phone libraries - usually a zip file
set PHONE_LIBS=C:\nokia\devices\Nokia_7210_MIDP_SDK_v1_0\lib\classes.zip
rem - emulator, note its commented out at the bottom, uncomment if
rem - you want the emulator to run every time you build
set EMULATOR=C:\nokia\devices\Nokia_7210_MIDP_SDK_v1_0\bin\7210.exe
rem -----------+---------------+------------- rem
rem -----------| Actual Script |------------- rem
rem -----------+---------------+------------- rem
PATH=%JAVABIN_LOC%;%PREVERIFY_LOC%:%PATH%
rem ---------------------------------------------
echo Compiling %PROG%.java:
javac.exe -bootclasspath %PHONE_LIBS% %PROG%.java
rem ---------------------------------------------
echo Preverifing: %PROG%.class
preverify.exe -classpath %PHONE_LIBS% -d . %PROG%
rem ---------------------------------------------
echo Making Manifest: MANIFEST.MF
rem - Note: first echo uses > and not >>
echo Manifest-Version: 1.0.0 > MANIFEST.MF
echo MIDlet-Name: %PROG% >> MANIFEST.MF
echo MIDlet-Version: 1.0.0 >> MANIFEST.MF
echo MIDlet-Vendor: MyVendor >> MANIFEST.MF
echo MicroEdition-Profile: MIDP-1.0 >> MANIFEST.MF
echo MicroEdition-Configuration: CLDC-1.0 >> MANIFEST.MF
echo MIDlet-1: %PROG%,,%PROG% >> MANIFEST.MF
rem ---------------------------------------------
echo Jaring:
jar -cfm %PROG%.jar MANIFEST.MF %PROG%.class
rem ---------------------------------------------
echo Making Jad:
rem - Note: first echo uses > and not >>
echo MIDlet-Name: %PROG% > %PROG%.jad
echo MIDlet-Version: 1.0.0 >> %PROG%.jad
echo MIDlet-Vendor: MyVendor >> %PROG%.jad
echo MicroEdition-Profile: MIDP-1.0 >> %PROG%.jad
echo MicroEdition-Configuration: CLDC-1.0 >> %PROG%.jad
echo MIDlet-Jar-URL: %PROG%.jar >> %PROG%.jad
echo MIDlet-Jar-Size: 12345 -- FIX THIS - FIX THIS -- >> %PROG%.jad
echo MIDlet-1: %PROG%, ,%PROG% >> %PROG%.jad
rem ---------------------------------------------
rem - cleanup unneeded files
del *.class MANIFEST.MF
rem ---------------------------------------------
rem - get the size of the jar file for the jad
dir /w /-C %PROG%.jar
rem ---------------------------------------------
echo Build Complete:
echo You must now hand edit %PROG%.jad and correct MIDlet-Jar-Size:
echo Size shown above, eg:
echo --------------------------------
echo "1 File(s) 1303 bytes"
echo --------------------------------
echo Press a key and notepad will load
pause
rem ---------------------------------------------
notepad %PROG%.jad
echo Build Complete:
pause
rem - to run emulator
rem %EMULATOR% -classpath %PROG%.jar -Xdescriptor %PROG%.jad
Some Words of warning:
The batch file is for xp, will probably run on 98 but its not tested.
The batch file has zero error checking, so change the settings at the top and get them right.
The batch file is only setup to deal with a project of one file
The batch file cannot correctly setup one of the .jad entries, so you have to hand edit it after.
If you have cygwin you can do:
wc -c %PROG%.jar | awk '{print $1}
To get the filesize of the jar, but wc and awk are not part of any standard windows installation.
---
This example should work with any emulator and any phone.
Hope this helps.
Alex
rikard_wigforss@hotmail.com
2004-05-31, 15:31
What's wrong with just using Wireless Toolkit? If you are a beginner it would be the most simple thing to do. Just place the Nokia Emulators (Like the one for 3510i) in the wtklib\devices directory and then build everything in WTK. I am convinced your problem is the MIDP version. It should be 1.0!
alex_crowther
2004-05-31, 20:15
At the risk of starting a flame war ..
If your just starting something new, its better to understand completely what it is your doing.
The toolbar hides much of that from you. As a result you have less of a clue as to what's going on.
In the same way, I would recommend learning assembler as well as C because in order to program in asm you have to really understand what's going on, and writing a few programs in asm will generally make you write better C code.
Basically, its my opinion, and approach to life, that you can never fail to benefit from having a complete understanding of something rather than a partial one.
Going back to the tool, I would personally recommend using a script (like the one I posted first), and then if you want to use a GUI, like the toolbar or eclipse etc, learn
them second. If nothing else, understanding how the script works will make working with the GUI's easier.
---
Has anyone tried my example code ?
Was it as fool proof as I tried to make it ?
Alex