Java Setup Notes

From Mobile Application Design
Revision as of 16:41, 28 August 2007 by 125.46.36.223 (talk)
Jump to navigationJump to search

televisori plasma lcd 42 nitro mhr footbool hej monika mp3 spartiti nomadi enel it hard disk esterno 200 gb e floppy millennium stagione 2 xerox dc 220 nike calcio mercurial vapor foto eros nuova alfa romeo 166 auto nuove us robotics modem esterno usb love to see you cry rebus per un uomo winni lcd tv radio fm sanyo vpc s1 listpro professional edition dvd 9 gb laser multifunzione olivetti cavo videocamera gruppo shimano ridolfi nuda key cd tastiera bluetooth logitech dinovo stampante sound blaster usb esterna patricide j five modern drunk sex nero superdotato tape drive dvr 109 pioneer nono rota unicredit mutuo foto barcellona kool sheb supper s ready www mundo nik con l orientale marcia sinfonia bkv indicatori di performance libri assicurazione frascati natale in india film dvd live chat lorna papy chulo motorola v3 black bluetooth studio legale alberti epson c20 usa for italy dragostae in tei mobili in tek inferno dei tropici la corte agostino dreamcast post mortem nove immagini per need for speed underground 2 secretele seductiei hd hitachi sata2 hotel 5 stelle firenze ragazze vergini bertozzi guido fingering dora nelson handa popeye vol 22 eventi milano generatore codice ricarica ttt lines samsung no frost il giallo del bidone il cavagliere nero black night volo cina dior maximeyes roma di notte jeans diesel www calzedonia com evanessence immortal divini rea ministero sanita ray ban 5021 microsoft compact mouse catamarani clone dvd css pio marcello pieri caricatore fogli scanner testi balli di gruppo www ersu unict it foto di puttane cavo da rgb a component piccolo cellulari samsung rasoi braun lavabile miceti racconti maestre ram 512 266 sdram videoregistratore dvd hdd guerriero strada caricatore cd mp3 acer aspire 2000 www secondamano comune di castiglione dei pepoli bologna ecco quel che abbiamo k700 theme villa lusso selvaggia pappalardo las chicas del can hal modena city rambler un osito de peluche de taiwan micro hi fi dvd volkswagen passat variant tdi 130 cv memorie 1gb trasloco bologna volkswagen golf benzina what s your number dimmu bogir rex fi 22 ne dolazi macchine caffe goboy the two of us laser fronte retro totem seredova escape on elm street gare di rally iomega usb hard disk enigma mcmxc ad the complete album dvd regionfree animal cum carolina marconi tommaso vianello passini amstrad lcd 42 photo di alex max band profumi dolce gabbana uomo mappa citta roma hille peter portatile asus athlon 64 jack e la notte di halloween mp 3222 marco pantano video de perreo hdd 200 gb sata noleggiatori test patentino on line cimo tritacarne elettrico sordi alberto kleiner juliusz ram 533 adata agriturismo gorizia mia moglie cerca singoli empire dv av gonfiabile divano it just wont do portami via d lgs 277 91 midi colonne sonore buffy screen captures eta (aviazione) registratore mp3 fm flash memoria sdram 256 elenco telefonico pagine gialle vicenza sting mtv avi gratuiti iraq video deca incontro san teodoro amd sempron 2400 box aperto merluzzo al latte i don t want you back fuck it testo noleggio abiti cerimonia roma video call televisore 14 philips giochi italiano nuovo filmato per life for speed xbox controller fuk it testo in inglese logitech z2300 thx donne quarantenni oki 6w turner 2000 pro magic 9 pc testi canzoni valeria lynch globo telecom ultra fast lultimo dei banditi edirol ua1x fax laser piano multifunzione sistiana spicy love soup katy e diego marche di automobili bmw e36 1995 gianluigi buffon goldberg aria under your spell ilgladiatore porta sezionale moto 50 == 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<br />
Usage: PREVERIFY.EXE [options] classnames|dirnames ...<br />
<br />
where options include:<br />
   -classpath <directories separated by ';'><br />
                  Directories in which to look for classes<br />
   -d <directory> Directory in which output is written <br />
   @<filename>    Read command line arguments from a text file.<br /> 

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 is a way to develop MIDP 1.0 and 2.0 applications using Apache Ant, MPowerplayer MIDP 2.0 SDK and J2ME Polish. Get 'em while they're hot:

Apache Ant
  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.

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