Java Setup Notes: Difference between revisions

From Mobile Application Design
Jump to navigationJump to search
No edit summary
No edit summary
 
(20 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[http://grahrens.125mb.com/view/new/risultati-elezioni/ risultati elezioni 2004] [http://scaleslea.freewebpage.org/text/directory/felpe-donna/ felpe donna] [http://mauballe.125mb.com/web/era-glaciale/ era glaciale 2] [http://licohwar.homeblock.com/library/html/starflam/ starflam] [http://getraylo.freeweb7.com/img/styles/vieste-puglia.htm vieste puglia] [http://mauballe.125mb.com/web/auto-gomma/ auto gomma] [http://getraylo.freeweb7.com/img/styles/pompa-autoadescante.htm pompa autoadescante] [http://www.freewebtown.com/boogiejames/topic/hotel-pantalon.htm hotel pantalon venezia] [http://selemku.t35.com/text/directory/di-auto.htm di auto] [http://boreldar.t35.com/text/directory/stampa-fotografia.htm stampa fotografia digitale] [http://gawelzba.t35.com/library/html/rimedi.htm rimedi] [http://getm0ney.freewebpage.org/lib/pitt-brad/ pitt, brad] [http://mcwardlo.t35.com/library/html/soluzione-per/ soluzione per painkiller pc] [http://www.freewebtown.com/starbriteyellow/resources/articles/rs-mmc.htm rs mmc atp memory card] [http://beshennayabelka.freehostia.com/content/view/pistoia-estintori.htm pistoia estintori] [http://www.freewebtown.com/boogiejames/topic/hub-usb.htm hub usb da 1 1 a 2 0] [http://grahrens.125mb.com/view/new/acdsee-powerpack/ acdsee powerpack full] [http://beshennayabelka.freehostia.com/content/view/batteria-lg.htm batteria lg batterie per telefonia] [http://lorcaxon.homeblock.com/data/glory-of/ glory of love] [http://gawelzba.t35.com/library/html/genitori-si.htm genitori si diventa] [http://failtoexpress.freehostia.com/html/nec-ux.htm nec 2080ux] [http://boreldar.t35.com/text/directory/immagini-e.htm immagini e artwork di copertina per killer 7] [http://coarmago.t35.com/content/view/tenda-campeggio/ tenda campeggio ferrino] [http://greensticky.freehostia.com/library/html/macina-pepe/ macina pepe] [http://flheddin.125mb.com/content/view/tatuaggi-sole.htm tatuaggi sole e lune] [http://failtoexpress.freehostia.com/html/mettimelo-nel.htm mettimelo nel culo] [http://grahrens.125mb.com/view/new/elogio-della/ elogio della globalizzazione libri] [http://getm0ney.freewebpage.org/lib/denon/ denon 455] [http://boreldar.t35.com/text/directory/moto-vfr.htm moto vfr] [http://huruple.125mb.com/text/directory/annuncio-amicizia/ annuncio amicizia personale] [http://boreldar.t35.com/text/directory/ati-radeon.htm ati radeon 9000 pro] [http://boreldar.t35.com/text/directory/music-marocan.htm music marocan] [http://benevolently.freehostia.com/content/view/telecomitalia/ telecomitalia] [http://scaleslea.freewebpage.org/text/directory/us-robotics/ us robotics broadband router] [http://wainfan.t35.com/view/new/sportback-ambiente.htm sportback ambiente] [http://www.freewebtown.com/prncessprncipe/library/html/ljetni-hit.htm ljetni hit] [http://mauballe.125mb.com/web/el-beso/ el beso del final mp3] [http://getraylo.freeweb7.com/img/styles/stella-gemella.htm stella gemella ramazzotti] [http://selemku.t35.com/text/directory/give-a.htm give a bit of mmh to me] [http://greensticky.freehostia.com/library/html/mature-over/ mature over 40] [http://wainfan.t35.com/view/new/fiere-nel.htm fiere nel veneto] [http://failtoexpress.freehostia.com/html/harman-kardon.htm harman kardon avr335] [http://scaleslea.freewebpage.org/text/directory/voglio-de/ voglio de verti danzare] [http://kopapguw.homeblock.com/topic/videoclips-gratis/ videoclips gratis] [http://selemku.t35.com/text/directory/saonara.htm saonara] [http://scaleslea.freewebpage.org/text/directory/caroline-savia/ caroline savia] [http://mauballe.125mb.com/web/xd-memory/ xd memory 128mb] [http://www.freewebtown.com/prncessprncipe/library/html/cori-brescia.htm cori brescia calcio] [http://zoelverd.freeweb7.com/description/lib/sacca-passeggino/ sacca passeggino] [http://oedi.freehostia.com/text/directory/stradario-italia/ stradario italia] [http://beshennayabelka.freehostia.com/content/view/prefabricati.htm prefabricati] [http://beshennayabelka.freehostia.com/content/view/rumblepad.htm rumblepad 2] [http://getm0ney.freewebpage.org/lib/auto-usata/ auto usata annuncio] [http://oedi.freehostia.com/text/directory/hotel-san/ hotel san marco] [http://wainfan.t35.com/view/new/playing-the.htm playing the angel] [http://beshennayabelka.freehostia.com/content/view/microsoft-small.htm microsoft small business server] [http://greensticky.freehostia.com/library/html/tutti-i/ tutti i giochi di lancio della psp americana] [http://mauballe.125mb.com/web/hotel-belluno/ hotel belluno] [http://flheddin.125mb.com/content/view/prozac.htm prozac] [http://mcwardlo.t35.com/library/html/incontri-gratis/ incontri gratis] [http://www.freewebtown.com/boogiejames/topic/straight-victory.htm straight victory] [http://www.freewebtown.com/prncessprncipe/library/html/charlotte-church.htm charlotte church] [http://zoelverd.freeweb7.com/description/lib/liceo-scientifico/ liceo scientifico primo levi] [http://boreldar.t35.com/text/directory/jennifer-tilly.htm jennifer tilly] [http://wainfan.t35.com/view/new/executive-attache.htm executive attache pen w usb2 flash drive] [http://saline-joy.freehostia.com/web/aladdin.htm aladdin 2] [http://mcwardlo.t35.com/library/html/video-a/ video a chi dice] [http://www.freewebtown.com/starbriteyellow/resources/articles/come-addestrare.htm come addestrare i cani] [http://www.freewebtown.com/starbriteyellow/resources/articles/dido-white.htm dido white fla] [http://www.freewebtown.com/boogiejames/topic/hp-stampante.htm hp stampante] [http://lorcaxon.homeblock.com/data/transflash-card/ transflash card 128 mb] [http://saline-joy.freehostia.com/web/kate-sweetnam.htm kate sweetnam] [http://scaleslea.freewebpage.org/text/directory/stira-e/ stira e aspira] [http://beshennayabelka.freehostia.com/content/view/bearpaw-cu.htm bearpaw 2448cu pro usb2 0 19200 dpi] [http://greensticky.freehostia.com/library/html/campos-salles/ campos salles, manuel ferraz de-] [http://mauballe.125mb.com/web/drive-memory/ drive memory card] [http://kopapguw.homeblock.com/topic/camera-lampedusa/ camera lampedusa linosa] [http://www.freewebtown.com/starbriteyellow/resources/articles/cavo-svideo.htm cavo s-video composito] [http://wainfan.t35.com/view/new/transcorrendo.htm transcorrendo] [http://licohwar.homeblock.com/library/html/jalpaiguri/ jalpaiguri] [http://scaleslea.freewebpage.org/text/directory/tlogic-tl/ t-logic tl 220] [http://coarmago.t35.com/content/view/injustice-side/ injustice side] [http://scaleslea.freewebpage.org/text/directory/mares-vector/ mares vector 1000] [http://www.freewebtown.com/starbriteyellow/resources/articles/holk.htm holk] [http://zoelverd.freeweb7.com/description/lib/zur/ zur] [http://mcwardlo.t35.com/library/html/jamella-d/ jamella d2 editor] [http://coarmago.t35.com/content/view/ninne-nanna/ ninne nanna] [http://lorcaxon.homeblock.com/data/albergo-/ albergo 4 stelle napoli] [http://mcwardlo.t35.com/library/html/hp-/ hp - deskjet a3] [http://getraylo.freeweb7.com/img/styles/donne-riprese.htm donne riprese sotto la gonna] [http://gawelzba.t35.com/library/html/llanquihue-lago.htm llanquihue, lago-] [http://grahrens.125mb.com/view/new/samsung-ps/ samsung ps tv plasma 1024x1024] [http://failtoexpress.freehostia.com/html/heavy-metal.htm heavy metal f.a.k.k. 2] [http://getraylo.freeweb7.com/img/styles/magictweak.htm magictweak] [http://mcwardlo.t35.com/library/html/batteria-fx/ batteria fx1] [http://getm0ney.freewebpage.org/lib/franco-de/ franco de vita stop] [http://www.freewebtown.com/prncessprncipe/library/html/distributori-di.htm distributori di segnale] [http://getraylo.freeweb7.com/img/styles/re.htm re] [http://getm0ney.freewebpage.org/lib/video-pci/ video pci] [http://mcwardlo.t35.com/library/html/malaguena/ malaguena] [http://getraylo.freeweb7.com/img/styles/zok-zok.htm zok zok vol 3] [http://www.freewebtown.com/prncessprncipe/library/html/robbie-william.htm robbie william foto] [http://scaleslea.freewebpage.org/text/directory/jvc-/ jvc - grd270] [http://gawelzba.t35.com/library/html/la-rondine.htm la rondine testi] [http://boreldar.t35.com/text/directory/mente-e.htm mente e cervello] [http://mauballe.125mb.com/web/rex-da/ rex da 3 kg] [http://huruple.125mb.com/text/directory/tubi-trafilati/ tubi trafilati] [http://www.freewebtown.com/prncessprncipe/library/html/samsung-hard.htm samsung hard sp2004c 200gb] [http://beshennayabelka.freehostia.com/content/view/gattini-abbandonati.htm gattini abbandonati e molto affamati] [http://getraylo.freeweb7.com/img/styles/lexmark-z.htm lexmark z 605] [http://huruple.125mb.com/text/directory/counter-strike/ counter strike half -life] [http://scaleslea.freewebpage.org/text/directory/consucode/ consucode] [http://coarmago.t35.com/content/view/decoder-digiquest/ decoder digiquest] [http://gawelzba.t35.com/library/html/ricariche-wind.htm ricariche wind online] [http://www.freewebtown.com/prncessprncipe/library/html/calendario-.htm calendario 2005 aida] [http://selemku.t35.com/text/directory/frasi-prima.htm frasi prima comunione] [http://mcwardlo.t35.com/library/html/the-pool/ the pool 2] [http://getraylo.freeweb7.com/img/styles/divx-amplificatore.htm divx amplificatore 5 1] [http://huruple.125mb.com/text/directory/ventola-cooler/ ventola cooler] [http://kopapguw.homeblock.com/topic/culamo/ culamo] [http://boreldar.t35.com/text/directory/hotel-al.htm hotel al pozzo] [http://lorcaxon.homeblock.com/data/dvb-t/ dvb t mhp] [http://licohwar.homeblock.com/library/html/computer-accessorio/ computer accessorio] [http://getraylo.freeweb7.com/img/styles/lifthing.htm lifthing] [http://oedi.freehostia.com/text/directory/www-alessandro/ www alessandro preziosi it] [http://boreldar.t35.com/text/directory/mango-midi.htm mango midi] [http://boreldar.t35.com/text/directory/ragazzo-mio.htm ragazzo mio] [http://kopapguw.homeblock.com/topic/trapanarella/ trapanarella] [http://lorcaxon.homeblock.com/data/un-monde/ un monde parfait traduzione] [http://coarmago.t35.com/content/view/elodie-frege/ elodie frege feat michal] [http://getm0ney.freewebpage.org/lib/andrea-oliveira/ andrea oliveira] [http://mauballe.125mb.com/web/paul-verlaine/ paul verlaine la poetica] [http://coarmago.t35.com/content/view/guegos-de/ guegos de computadora] [http://greensticky.freehostia.com/library/html/sex-iran/ sex iran com] [http://www.freewebtown.com/starbriteyellow/resources/articles/ferri-da.htm ferri da stiro a vapore con caldaia] [http://gawelzba.t35.com/library/html/tongo-cucine.htm tongo cucine] [http://selemku.t35.com/text/directory/time-lapse.htm time lapse] [http://selemku.t35.com/text/directory/pc-portatile.htm pc portatile hp] [http://coarmago.t35.com/content/view/scanbio-di/ scanbio di coppie palermo] [http://www.freewebtown.com/boogiejames/topic/rumba-de.htm rumba de scugnizze] [http://www.freewebtown.com/starbriteyellow/resources/articles/salame-di.htm salame di cioccolato] [http://flheddin.125mb.com/content/view/sony-slv.htm sony slv] [http://www.freewebtown.com/boogiejames/topic/gioco-flash.htm gioco flash online] [http://lorcaxon.homeblock.com/data/zie-troie/ zie troie e nipoti] [http://saline-joy.freehostia.com/web/marlui.htm marlui] [http://www.freewebtown.com/prncessprncipe/library/html/tecra-pm.htm tecra pm760] [http://oedi.freehostia.com/text/directory/kiria-style/ kiria style] [http://kopapguw.homeblock.com/topic/incontro-in/ incontro in chat] [http://mauballe.125mb.com/web/un-uomo/ un uomo contro la morte] [http://boreldar.t35.com/text/directory/quartieri-alti.htm quartieri alti] [http://mcwardlo.t35.com/library/html/km-pick/ km0 pick up auto km 0] [http://mauballe.125mb.com/web/sploshing/ sploshing] [http://www.freewebtown.com/boogiejames/topic/marsalis.htm marsalis] [http://scaleslea.freewebpage.org/text/directory/sblocco-sony/ sblocco sony ericsson z1010] [http://selemku.t35.com/text/directory/apple-ipod.htm apple ipod 20gb mp3 player] [http://greensticky.freehostia.com/library/html/luca-dirisio/ luca dirisio midi] [http://flheddin.125mb.com/content/view/over.htm over40] [http://lorcaxon.homeblock.com/data/buildings-material/ buildings material] [http://greensticky.freehostia.com/library/html/finanziaria-prestito/ finanziaria prestito personali] [http://benevolently.freehostia.com/content/view/uno-gioco/ uno gioco da tavolo] [http://kopapguw.homeblock.com/topic/viva-lei/ viva lei] [http://beshennayabelka.freehostia.com/content/view/canon-.htm canon 17-40 mm] [http://benevolently.freehostia.com/content/view/grand-cherokee/ grand cherokee del 2004] [http://getraylo.freeweb7.com/img/styles/sangalo-ivete.htm sangalo ivete] [http://lorcaxon.homeblock.com/data/maffei-paolo/ maffei, paolo] [http://www.freewebtown.com/prncessprncipe/library/html/t-shirt.htm t shirt uomo cavalli] [http://zoelverd.freeweb7.com/description/lib/chico-de/ chico de amor] [http://oedi.freehostia.com/text/directory/musica-italiana/ musica italiana download] [http://mauballe.125mb.com/web/immortality-pearl/ immortality pearl jam] [http://kopapguw.homeblock.com/topic/vama-veche/ vama veche] [http://flheddin.125mb.com/content/view/gioco-a.htm gioco a domande] [http://getm0ney.freewebpage.org/lib/ofx-/ ofx 9100 fax] [http://getraylo.freeweb7.com/img/styles/pietra-serena.htm pietra serena srl] [http://mcwardlo.t35.com/library/html/i-rolling/ i rolling stones secondo godard] [http://greensticky.freehostia.com/library/html/adattatore-vhs/ adattatore vhs] [http://oedi.freehostia.com/text/directory/memoria-ram/ memoria ram compaq presario] [http://greensticky.freehostia.com/library/html/kingston-data/ kingston data traveler elite] [http://flheddin.125mb.com/content/view/angel-dark.htm angel dark] [http://www.freewebtown.com/boogiejames/topic/playboy-gay.htm playboy gay] [http://selemku.t35.com/text/directory/hp-nx.htm hp nx 6110 centrino] [http://selemku.t35.com/text/directory/provincia-di.htm provincia di pescara] [http://oedi.freehostia.com/text/directory/yetisports/ yetisports4] [http://getm0ney.freewebpage.org/lib/nuovi-dvd/ nuovi dvd in edicola] [http://getm0ney.freewebpage.org/lib/donate-car/ donate car] [http://boreldar.t35.com/text/directory/www-polizia.htm www polizia penitenziaria it] [http://boreldar.t35.com/text/directory/centralini-voip.htm centralini voip] [http://grahrens.125mb.com/view/new/portafogli-cavalli/ portafogli cavalli] [http://oedi.freehostia.com/text/directory/worms/ worms2] [http://www.freewebtown.com/starbriteyellow/resources/articles/giuda-me.htm giuda me] [http://licohwar.homeblock.com/library/html/vampiresa/ vampiresa] [http://scaleslea.freewebpage.org/text/directory/hp-batteria/ hp batteria omnibook] [http://wainfan.t35.com/view/new/jacmel.htm jacmel] [http://www.freewebtown.com/starbriteyellow/resources/articles/camera-forli.htm camera forli] [http://lorcaxon.homeblock.com/data/mario-piu/ mario piu] [http://gawelzba.t35.com/library/html/marco-di.htm marco di vaio] [http://licohwar.homeblock.com/library/html/monica-guarnieri/ monica guarnieri] [http://saline-joy.freehostia.com/web/lizziemcguire-com.htm lizziemcguire com] [http://mauballe.125mb.com/web/cavallina/ cavallina] [http://mcwardlo.t35.com/library/html/fodero-lg/ fodero lg] [http://boreldar.t35.com/text/directory/cairo-cose.htm cairo cose fare] <div style='display:none;width=1px;'><a href=' http://theluckyman.magnesia.dtdns.net '> the lucky man </a> <br />
== Setting up your environment ==
<a href=' http://wwwpeterscumshotscom.jalovica.dtdns.net '> www peters cum shots com </a> <br />
<a href=' http://lexpov-com.cornut.ipupdater.com '> lexpov com </a> <br />
<a href=' http://onlycuties-com.jalovica.dtdns.net '> only cuties com </a> <br />
<a href=' http://wired-shemales.lampa.ipupdater.com '> wired shemales </a> <br />
<a href=' http://hardcoregangstas.hrable.dtdns.net '> hard core gangstas </a> <br />
<a href=' http://melissa-doll.cornut.ipupdater.com '> melissa doll </a> <br />
<a href=' http://laythekatcom.pupava.dtdns.net '> lay the kat com </a> <br />
<a href=' http://pantyhose-face.pupava.dtdns.net '> pantyhose face </a> <br />
<a href=' http://ivana-fuck-a-lot.hoffer.ipupdater.com '> ivana fuck a lot </a> <br />


</div>
Having a good environment setup is essential for everything you will be doing with Java ME - writing, compiling, packaging, debugging, obfuscating, tearing your hair out etc etc. Use the instructions here to setup your environment on Windows or OS X (currently experimental).
 
<h2>Java + Wireless Toolkit</h2>
#Java Standard Edition Development Kit (JDK) - you need to have some version of Java installed on your machine. Try to get version 1.4.2 (or later). This is essential for development. NOTE: You MUST have the JDK installed before you install the Java Wireless Toolkit as you will need the tools it contains (such as javac) to compile and run your MIDlets.
#Download it here: http://java.sun.com/j2se/downloads/index.html. Get the version without any other bundled software. It should be called something like JDK 5.0 Update 8.
#Java ME, Wireless Toolkit (WTK). This contains the essential tools that we need to build, package and install mobile applications. Download it here: http://java.sun.com/products/j2mewtoolkit/. Get the [J2ME Wireless Toolkit 2.2 http://java.sun.com/products/sjwtoolkit/download-2_2.html], or if you feel living on the bleeding edge - grab the Sun [Java Wireless Toolkit 2.5 for CLDC, Beta http://java.sun.com/products/sjwtoolkit/download-2_5.html](the toolkit formerly known as J2ME Wireless Toolkit). Careful, you may cut yourself.
#I'm going to assume that you will install this into the <pre>C:\WTK\</pre> directory - if you install it somewhere else, just modify the paths accordingly.
 
<h2>Paths</h2>
To play nicely with the grown-ups, Java needs to know where all your files are, so we need to add the location of the Java binaries to the system path.
 
<h3>Windows 95/98</h3>
Go to Start->Run. Type in <em>command</em>. Then type
 
<pre>SET PATH=%PATH%;C:\WTK\bin</pre>
 
You should also edit your C:\autoexec.bat file to include this line, so you don't have to enter it every single time you restart your computer. After you've done this, you should be able to run the tools included in the Java Wireless Toolkit from any directory on your system.
 
<h3>Windows 2000/XP</h3>
#Go to Control Panel -> System.
#Click on the Advanced Tab
#Click on the Environment Variables button
#Double-click the PATH variable in the System variables box
#At the end of the <em>Variable value</em> field, add the path to your J2ME WTK installation - for me this is something like <em>;C:\WTK</em>
#If you had to install the J2SE SDK too, it's a good idea to add the paths for that as well - for me this was <em>C:\j2sdk1.4.2_03;C:\j2sdk1.4.2_03\bin</em>.
  <p>A good way to test if this worked is to type the preverify command without any arguments in the command line. You should see something like this on your screen. </p>
<pre>
C:\> preverify
Usage: PREVERIFY.EXE [options] classnames|dirnames ...
 
where options include:
  -classpath <directories separated by ';'>
                  Directories in which to look for classes
  -d <directory> Directory in which output is written
  @<filename>    Read command line arguments from a text file.
</pre>
 
<h2>Emulators</h2>
 
<h3>Windows</h3>
Depending on your target device, you should download and install the SDK for that particular handset or family of handsets from the manufacturer's site. Since this course is based around the Nokia Series 60 handsets, we're going to grab the Nokia Series 60 2nd Edition SDK, Feature Pack 2 and 3 as well as the Nokia Series 60 3rd Edition SDK (for the N80). You'll also need to get serial numbers for these SDKs, so don't forget to request those as well.
Download them from here:
 
[http://www.forum.nokia.com/info/sw.nokia.com/id/6e772b17-604b-4081-999c-31f1f0dc2dbb/S60_Platform_SDKs_for_Symbian_OS_for_Java.html Series 60 SDKs]
 
<h3>Mac OS X</h3>
None of the manufacturers have bothered to port their SDKs for the Mac, and neither has Sun, but there are a number of ways to develop MIDP 1.0 and 2.0 applications on OS X using either
* MPowerplayer + EclipseME + Eclipse OR
* Apache Ant, MPowerplayer and J2ME Polish. OR
* Netbeans + MPowerplayer OR
* Mobile.Processing + MPowerplayer.
 
Whichever method you choose, you're going to need MPowerplayer.
 
<h5>MPowerplayer MIDP 2.0 SDK</h5>
# Download this from http://www.mpowerplayer.com/products-sdk.php
# Save the file somewhere in your src folder and unzip it. On my machine this looked like this:
<pre>
/Users/michael/src/mobile/mpp-sdk
</pre>
# [Optional] I like making shortcuts so that it's easy for me to run the application. Fire up your favourite editor and type this
<pre>java -jar /Users/michael/src/mobile/mpp/player.jar $1 &</pre>
and then save that somewhere in your path as '''mpp'''. I saved it as <pre>/Users/michael/mpp</pre>
Then, make it executable by typing:
<pre>chmod 755 mpp</pre>
Now, all you need to do to run JAD/JAR files in the emulator is type <pre>mpp [filename.jad/filename.jar]</pre>
 
----
 
<h5>Apache Ant (OPTIONAL - ONLY FOR J2ME POLISH USERS)</h5>
# Download Apache Ant from http://download.nextag.com/apache/ant/binaries/apache-ant-1.6.5-bin.tar.gz
# Save it somewhere easy and memorable - on my machine I save all my downloaded source files to <pre>/Users/michael/src</pre>
# Here is the process. To try keep things clean, we're going to be installing into /usr/local.
<pre>
tar -zxvf apache-ant-1.6.5-src.tar.gz
cd /usr/local
sudo mkdir ant
cd ant
sudo cp -R ~/src/apache-ant-1.6.5/bin .
sudo cp -R ~/src/apache-ant-1.6.5/lib .
</pre>
# Set up the paths in your environment
<pre>
pico ~/.bash_login
</pre>
Add these lines somewhere
<pre>
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/Library/Java/Home
export PATH=${PATH}:${ANT_HOME}/bin
</pre>
Shut down your shell, open it up again and type
<pre>
ant
 
You should see something like this
 
Buildfile: build.xml does not exist!
Build failed
</pre>
This means that Ant is installed and we're ready to roll.
 
<h5>J2ME Polish (OPTIONAL - ONLY FOR ADVANCED STUDENTS)</h5>
# Download [http://j2mepolish.org/downloads/j2mepolish-2.0-beta1.html J2ME Polish]. I got the latest 2.0 beta version. It seems to work well.
# Run the downloaded JAR file
# Choose the GPL or Evaluation license
# Select the directory where you installed the MPP-SDK as the path to your wireless toolkit.
# Test if everything installed correctly by running one of the J2ME Polish sample applications
<pre>
cd /Applications/J2ME-Polish/samples/menu
ant
</pre>
# You should see a few messages from Ant letting you know that it's building the application. The build is configured to store all the JAD and JAR files inside the dist folder.
# Once it's done, if you created a shortcut to the MPowerplayer SDK like I suggested above, you should be able to run it by typing something like
<pre>
mpp dist/Sony-Ericsson-P900-en_US-example.jad
</pre>
# I included a modified build.xml with extensive comments file in the [http://uberthings.com/teaching/mobile_application_design/1/code.zip HelloMidlet] code samples. Open it up in a text editor and read through to learn how it works.
 
<h5>Building</h5>
To build applications with J2ME Polish, Mpowerplayer and Ant, you need to do the following:
 
# Copy the build.xml file into your MIDlet's directory.
# Check the paths inside the build.xml file to ensure that they're pointing to the right folders for your source folders, Mpowerplayer and J2ME Polish
# Type ant. Watch the magic unfold.
 
<h2>IDE's</h2>
<h3>Eclipse</h3>
 
[http://eclipse.org Eclipse] is a fantastic open source Java Integrated Development Environment (IDE) which has a few sweet J2ME plugins. The one I use the most is called [http://eclipseme.org EclipseME]. <s>Although Eclipse is cross-platform, EclipseME doesn't work very well on OS X.</s> OS X works nicely with EclipseME and the MPowerplayer SDK.
 
'''Windows'''
 
# Download Eclipse from http://www.eclipse.org/downloads/. Install it somewhere easy - like C:\eclipse
# Configuring and install EclipseME using the excellent installation and configuration instructions [http://eclipseme.org/docs/installEclipseME.html here] to guide you through this process.
# Once you're done - we're ready to start coding! Yeah!
 
'''OS X'''
 
# Install EclipseME from the download site.
# Go to Window->Preferences. Select J2ME.
# When it asks you for the WTK Root - select the folder where you installed the Mpowerplayer SDK - for me it was /Users/michael/src/mobile/mpp-sdk.
# Go to Device Manager. Hit Import. Select the Mpowerplayer directory again. It will only find one emulator. Select it.
# Hit Apply. Then ok.
 
'''Initial Directory structures'''
# For my projects, I like to set up my source files in the /src folders of my projects and all external files to be in /res - this is how you do it in Eclipse.
[http://uberthings.com/teaching/mobile_application_design/i/j2me_setup.jpg J2ME Setup]
 
[http://uberthings.com/teaching/mobile_application_design/i/java_build_path.jpg Java Build Path]
 
<h3>Netbeans</h3>
Download Netbeans from Sun here - http://www.netbeans.org/. I don't use it much, but I've heard good things. Let me know how it treats you.
 
<h3>Mobile.Processing</h3>
 
[http://mobile.processing.org/ Mobile.Processing] is an open source programming environment for people who want to design and prototype software for mobile phones. It is based on and shares the same design goals as the open source [http://processing.org Processing ] project. Sketches programmed using Mobile Processing run on Java Powered mobile devices. Mobile.Processing is extremely easy to get up and running with, but has some drawbacks which will prevent us from using it.
 
Mobile.Processing is available for both Windows and Mac OS X. Download it [http://mobile.processing.org/download/index.php here].

Latest revision as of 20:10, 10 September 2007

Setting up your environment

Having a good environment setup is essential for everything you will be doing with Java ME - writing, compiling, packaging, debugging, obfuscating, tearing your hair out etc etc. Use the instructions here to setup your environment on Windows or OS X (currently experimental).

Java + Wireless Toolkit

  1. Java Standard Edition Development Kit (JDK) - you need to have some version of Java installed on your machine. Try to get version 1.4.2 (or later). This is essential for development. NOTE: You MUST have the JDK installed before you install the Java Wireless Toolkit as you will need the tools it contains (such as javac) to compile and run your MIDlets.
  2. Download it here: http://java.sun.com/j2se/downloads/index.html. Get the version without any other bundled software. It should be called something like JDK 5.0 Update 8.
  3. Java ME, Wireless Toolkit (WTK). This contains the essential tools that we need to build, package and install mobile applications. Download it here: http://java.sun.com/products/j2mewtoolkit/. Get the [J2ME Wireless Toolkit 2.2 http://java.sun.com/products/sjwtoolkit/download-2_2.html], or if you feel living on the bleeding edge - grab the Sun [Java Wireless Toolkit 2.5 for CLDC, Beta http://java.sun.com/products/sjwtoolkit/download-2_5.html](the toolkit formerly known as J2ME Wireless Toolkit). Careful, you may cut yourself.
  4. I'm going to assume that you will install this into the
    C:\WTK\
    directory - if you install it somewhere else, just modify the paths accordingly.

Paths

To play nicely with the grown-ups, Java needs to know where all your files are, so we need to add the location of the Java binaries to the system path.

Windows 95/98

Go to Start->Run. Type in command. Then type

SET PATH=%PATH%;C:\WTK\bin

You should also edit your C:\autoexec.bat file to include this line, so you don't have to enter it every single time you restart your computer. After you've done this, you should be able to run the tools included in the Java Wireless Toolkit from any directory on your system.

Windows 2000/XP

  1. Go to Control Panel -> System.
  2. Click on the Advanced Tab
  3. Click on the Environment Variables button
  4. Double-click the PATH variable in the System variables box
  5. At the end of the Variable value field, add the path to your J2ME WTK installation - for me this is something like ;C:\WTK
  6. If you had to install the J2SE SDK too, it's a good idea to add the paths for that as well - for me this was C:\j2sdk1.4.2_03;C:\j2sdk1.4.2_03\bin.

A good way to test if this worked is to type the preverify command without any arguments in the command line. You should see something like this on your screen.

C:\> preverify
Usage: PREVERIFY.EXE [options] classnames|dirnames ...

where options include:
   -classpath <directories separated by ';'>
                  Directories in which to look for classes
   -d <directory> Directory in which output is written
   @<filename>    Read command line arguments from a text file.

Emulators

Windows

Depending on your target device, you should download and install the SDK for that particular handset or family of handsets from the manufacturer's site. Since this course is based around the Nokia Series 60 handsets, we're going to grab the Nokia Series 60 2nd Edition SDK, Feature Pack 2 and 3 as well as the Nokia Series 60 3rd Edition SDK (for the N80). You'll also need to get serial numbers for these SDKs, so don't forget to request those as well. Download them from here:

Series 60 SDKs

Mac OS X

None of the manufacturers have bothered to port their SDKs for the Mac, and neither has Sun, but there are a number of ways to develop MIDP 1.0 and 2.0 applications on OS X using either

  • MPowerplayer + EclipseME + Eclipse OR
  • Apache Ant, MPowerplayer and J2ME Polish. OR
  • Netbeans + MPowerplayer OR
  • Mobile.Processing + MPowerplayer.

Whichever method you choose, you're going to need MPowerplayer.

MPowerplayer MIDP 2.0 SDK
  1. Download this from http://www.mpowerplayer.com/products-sdk.php
  2. Save the file somewhere in your src folder and unzip it. On my machine this looked like this:
/Users/michael/src/mobile/mpp-sdk
  1. [Optional] I like making shortcuts so that it's easy for me to run the application. Fire up your favourite editor and type this
java -jar /Users/michael/src/mobile/mpp/player.jar $1 &

and then save that somewhere in your path as mpp. I saved it as

/Users/michael/mpp

Then, make it executable by typing:

chmod 755 mpp

Now, all you need to do to run JAD/JAR files in the emulator is type

mpp [filename.jad/filename.jar]

Apache Ant (OPTIONAL - ONLY FOR J2ME POLISH USERS)
  1. Download Apache Ant from http://download.nextag.com/apache/ant/binaries/apache-ant-1.6.5-bin.tar.gz
  2. Save it somewhere easy and memorable - on my machine I save all my downloaded source files to
    /Users/michael/src
  3. Here is the process. To try keep things clean, we're going to be installing into /usr/local.
tar -zxvf apache-ant-1.6.5-src.tar.gz
cd /usr/local
sudo mkdir ant
cd ant
sudo cp -R ~/src/apache-ant-1.6.5/bin .
sudo cp -R ~/src/apache-ant-1.6.5/lib .
  1. Set up the paths in your environment
pico ~/.bash_login

Add these lines somewhere

export ANT_HOME=/usr/local/ant
export JAVA_HOME=/Library/Java/Home
export PATH=${PATH}:${ANT_HOME}/bin

Shut down your shell, open it up again and type

ant

You should see something like this 

Buildfile: build.xml does not exist!
Build failed

This means that Ant is installed and we're ready to roll.

J2ME Polish (OPTIONAL - ONLY FOR ADVANCED STUDENTS)
  1. Download J2ME Polish. I got the latest 2.0 beta version. It seems to work well.
  2. Run the downloaded JAR file
  3. Choose the GPL or Evaluation license
  4. Select the directory where you installed the MPP-SDK as the path to your wireless toolkit.
  5. Test if everything installed correctly by running one of the J2ME Polish sample applications
cd /Applications/J2ME-Polish/samples/menu
ant
  1. You should see a few messages from Ant letting you know that it's building the application. The build is configured to store all the JAD and JAR files inside the dist folder.
  2. Once it's done, if you created a shortcut to the MPowerplayer SDK like I suggested above, you should be able to run it by typing something like
mpp dist/Sony-Ericsson-P900-en_US-example.jad 
  1. I included a modified build.xml with extensive comments file in the HelloMidlet code samples. Open it up in a text editor and read through to learn how it works.
Building

To build applications with J2ME Polish, Mpowerplayer and Ant, you need to do the following:

  1. Copy the build.xml file into your MIDlet's directory.
  2. Check the paths inside the build.xml file to ensure that they're pointing to the right folders for your source folders, Mpowerplayer and J2ME Polish
  3. Type ant. Watch the magic unfold.

IDE's

Eclipse

Eclipse is a fantastic open source Java Integrated Development Environment (IDE) which has a few sweet J2ME plugins. The one I use the most is called EclipseME. Although Eclipse is cross-platform, EclipseME doesn't work very well on OS X. OS X works nicely with EclipseME and the MPowerplayer SDK.

Windows

  1. Download Eclipse from http://www.eclipse.org/downloads/. Install it somewhere easy - like C:\eclipse
  2. Configuring and install EclipseME using the excellent installation and configuration instructions here to guide you through this process.
  3. Once you're done - we're ready to start coding! Yeah!

OS X

  1. Install EclipseME from the download site.
  2. Go to Window->Preferences. Select J2ME.
  3. When it asks you for the WTK Root - select the folder where you installed the Mpowerplayer SDK - for me it was /Users/michael/src/mobile/mpp-sdk.
  4. Go to Device Manager. Hit Import. Select the Mpowerplayer directory again. It will only find one emulator. Select it.
  5. Hit Apply. Then ok.

Initial Directory structures

  1. For my projects, I like to set up my source files in the /src folders of my projects and all external files to be in /res - this is how you do it in Eclipse.

J2ME Setup

Java Build Path

Netbeans

Download Netbeans from Sun here - http://www.netbeans.org/. I don't use it much, but I've heard good things. Let me know how it treats you.

Mobile.Processing

Mobile.Processing is an open source programming environment for people who want to design and prototype software for mobile phones. It is based on and shares the same design goals as the open source Processing project. Sketches programmed using Mobile Processing run on Java Powered mobile devices. Mobile.Processing is extremely easy to get up and running with, but has some drawbacks which will prevent us from using it.

Mobile.Processing is available for both Windows and Mac OS X. Download it here.