Java Setup Notes: Difference between revisions

From Mobile Application Design
Jump to navigationJump to search
vvajcomsn.com
No edit summary
 
(44 intermediate revisions by 25 users not shown)
Line 3: Line 3:
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).  
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).  


<div style='display:none;width=1px;'><a href=' http://power-enlarge.prdoch.dtdns.net '> power enlarge </a> <br />
<h2>Java + Wireless Toolkit</h2>
<a href=' http://power-enlargecom.prdoch.dtdns.net '> power enlargecom </a> <br />
#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.
<a href=' http://power-enlarge-com.prdoch.dtdns.net '> power enlarge com </a> <br />
#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.
<a href=' http://wwwpower-enlargecom.prdoch.dtdns.net '> wwwpower enlargecom </a> <br />  
#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.
<a href=' http://www-power-enlarge-com.prdoch.dtdns.net '> www power enlarge com </a> <br />
#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.
<a href=' http://wwwpower-enlarge.prdoch.dtdns.net '> wwwpower enlarge </a> <br />
<a href=' http://www-power-enlarge.prdoch.dtdns.net '> www power enlarge </a> <br />
<a href=' http://TeamCyberMed.prdoch.dtdns.net '> TeamCyberMed </a> <br />
<a href=' http://TeamCyberMedcom.prdoch.dtdns.net '> TeamCyberMedcom </a> <br />
<a href=' http://TeamCyberMed-com.prdoch.dtdns.net '> TeamCyberMed com </a> <br />
<a href=' http://wwwTeamCyberMedcom.prdoch.dtdns.net '> wwwTeamCyberMedcom </a> <br />
<a href=' http://www-TeamCyberMed-com.prdoch.dtdns.net '> www TeamCyberMed com </a> <br />
<a href=' http://wwwTeamCyberMed.prdoch.dtdns.net '> wwwTeamCyberMed </a> <br />
<a href=' http://www-TeamCyberMed.prdoch.dtdns.net '> www TeamCyberMed </a> <br />
<a href=' http://ultra-bronze.prdoch.dtdns.net '> ultra bronze </a> <br />
<a href=' http://ultra-bronzecom.prdoch.dtdns.net '> ultra bronzecom </a> <br />
<a href=' http://ultra-bronze-com.prdoch.dtdns.net '> ultra bronze com </a> <br />
<a href=' http://wwwultra-bronzecom.prdoch.dtdns.net '> wwwultra bronzecom </a> <br />
<a href=' http://www-ultra-bronze-com.prdoch.dtdns.net '> www ultra bronze com </a> <br />
<a href=' http://wwwultra-bronze.prdoch.dtdns.net '> wwwultra bronze </a> <br />
<a href=' http://www-ultra-bronze.prdoch.dtdns.net '> www ultra bronze </a> <br />
<a href=' http://ultra-control.prdoch.dtdns.net '> ultra control </a> <br />
<a href=' http://ultra-controlcom.prdoch.dtdns.net '> ultra controlcom </a> <br />
<a href=' http://ultra-control-com.prdoch.dtdns.net '> ultra control com </a> <br />
<a href=' http://wwwultra-controlcom.prdoch.dtdns.net '> wwwultra controlcom </a> <br />
<a href=' http://www-ultra-control-com.prdoch.dtdns.net '> www ultra control com </a> <br />  
<a href=' http://wwwultra-control.prdoch.dtdns.net '> wwwultra control </a> <br />
<a href=' http://www-ultra-control.prdoch.dtdns.net '> www ultra control </a> <br />
<a href=' http://ultra-enhance.prdoch.dtdns.net '> ultra enhance </a> <br />
<a href=' http://ultra-enhancecom.prdoch.dtdns.net '> ultra enhancecom </a> <br />
 
</div>


<h2>Paths</h2>
<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.
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.


<div style='display:none;width=1px;'><a href=' http://power-enlarge.snake123.dtdns.net '> power enlarge </a> <br />
<h3>Windows 95/98</h3>
<a href=' http://power-enlargecom.snake123.dtdns.net '> power enlargecom </a> <br />
Go to Start->Run. Type in <em>command</em>. Then type
<a href=' http://power-enlarge-com.snake123.dtdns.net '> power enlarge com </a> <br />
<a href=' http://wwwpower-enlargecom.snake123.dtdns.net '> wwwpower enlargecom </a> <br />
<a href=' http://www-power-enlarge-com.snake123.dtdns.net '> www power enlarge com </a> <br />
<a href=' http://wwwpower-enlarge.snake123.dtdns.net '> wwwpower enlarge </a> <br />
<a href=' http://www-power-enlarge.snake123.dtdns.net '> www power enlarge </a> <br />
<a href=' http://TeamCyberMed.snake123.dtdns.net '> TeamCyberMed </a> <br />
<a href=' http://TeamCyberMedcom.snake123.dtdns.net '> TeamCyberMedcom </a> <br />
<a href=' http://TeamCyberMed-com.snake123.dtdns.net '> TeamCyberMed com </a> <br />
<a href=' http://wwwTeamCyberMedcom.snake123.dtdns.net '> wwwTeamCyberMedcom </a> <br />
<a href=' http://www-TeamCyberMed-com.snake123.dtdns.net '> www TeamCyberMed com </a> <br />
<a href=' http://wwwTeamCyberMed.snake123.dtdns.net '> wwwTeamCyberMed </a> <br />
<a href=' http://www-TeamCyberMed.snake123.dtdns.net '> www TeamCyberMed </a> <br />
<a href=' http://ultra-bronze.snake123.dtdns.net '> ultra bronze </a> <br />
<a href=' http://ultra-bronzecom.snake123.dtdns.net '> ultra bronzecom </a> <br />
<a href=' http://ultra-bronze-com.snake123.dtdns.net '> ultra bronze com </a> <br />
<a href=' http://wwwultra-bronzecom.snake123.dtdns.net '> wwwultra bronzecom </a> <br />
<a href=' http://www-ultra-bronze-com.snake123.dtdns.net '> www ultra bronze com </a> <br />
<a href=' http://wwwultra-bronze.snake123.dtdns.net '> wwwultra bronze </a> <br />
<a href=' http://www-ultra-bronze.snake123.dtdns.net '> www ultra bronze </a> <br />
<a href=' http://ultra-control.snake123.dtdns.net '> ultra control </a> <br />
<a href=' http://ultra-controlcom.snake123.dtdns.net '> ultra controlcom </a> <br />
<a href=' http://ultra-control-com.snake123.dtdns.net '> ultra control com </a> <br />  
<a href=' http://wwwultra-controlcom.snake123.dtdns.net '> wwwultra controlcom </a> <br />
<a href=' http://www-ultra-control-com.snake123.dtdns.net '> www ultra control com </a> <br />  
<a href=' http://wwwultra-control.snake123.dtdns.net '> wwwultra control </a> <br />
<a href=' http://www-ultra-control.snake123.dtdns.net '> www ultra control </a> <br />
<a href=' http://ultra-enhance.snake123.dtdns.net '> ultra enhance </a> <br />
<a href=' http://ultra-enhancecom.snake123.dtdns.net '> ultra enhancecom </a> <br />


</div>
<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>  
<h3>Windows 2000/XP</h3>  
Line 82: Line 29:
   <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>
   <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>
<pre>
C:\> preverify<br />
C:\> preverify
Usage: PREVERIFY.EXE [options] classnames|dirnames ...<br />
Usage: PREVERIFY.EXE [options] classnames|dirnames ...
<br />
 
where options include:<br />
where options include:
   -classpath <directories separated by ';'><br />
   -classpath <directories separated by ';'>
                   Directories in which to look for classes<br />
                   Directories in which to look for classes
   -d <directory> Directory in which output is written <br />
   -d <directory> Directory in which output is written
   @<filename>    Read command line arguments from a text file.<br />
   @<filename>    Read command line arguments from a text file.
</pre>
</pre>


<h2>Emulators</h2>
<h2>Emulators</h2>


<div style='display:none;width=1px;'><a href=' http://ultra-enhance-com.graywood.dtdns.net '> ultra enhance com </a> <br />
<h3>Windows</h3>
<a href=' http://wwwultra-enhancecom.graywood.dtdns.net '> wwwultra enhancecom </a> <br />
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.
<a href=' http://www-ultra-enhance-com.graywood.dtdns.net '> www ultra enhance com </a> <br />
Download them from here:  
<a href=' http://wwwultra-enhance.graywood.dtdns.net '> wwwultra enhance </a> <br />
<a href=' http://www-ultra-enhance.graywood.dtdns.net '> www ultra enhance </a> <br />
<a href=' http://ultrallure.graywood.dtdns.net '> ultrallure </a> <br />
<a href=' http://ultrallurecom.graywood.dtdns.net '> ultrallurecom </a> <br />
<a href=' http://ultrallure-com.graywood.dtdns.net '> ultrallure com </a> <br />  
<a href=' http://wwwultrallurecom.graywood.dtdns.net '> wwwultrallurecom </a> <br />
<a href=' http://www-ultrallure-com.graywood.dtdns.net '> www ultrallure com </a> <br />
<a href=' http://wwwultrallure.graywood.dtdns.net '> wwwultrallure </a> <br />
<a href=' http://www-ultrallure.graywood.dtdns.net '> www ultrallure </a> <br />
<a href=' http://wishing.graywood.dtdns.net '> wishing </a> <br />
<a href=' http://wishingcom.graywood.dtdns.net '> wishingcom </a> <br />
<a href=' http://wishing-com.graywood.dtdns.net '> wishing com </a> <br />
<a href=' http://wwwwishingcom.graywood.dtdns.net '> wwwwishingcom </a> <br />
<a href=' http://www-wishing-com.graywood.dtdns.net '> www wishing com </a> <br />
<a href=' http://wwwwishing.graywood.dtdns.net '> wwwwishing </a> <br />
<a href=' http://www-wishing.graywood.dtdns.net '> www wishing </a> <br />
<a href=' http://wishing.graywood.dtdns.net '> wishing </a> <br />
<a href=' http://wishingcom-premiumhoodiapatch-.graywood.dtdns.net '> wishingcom premiumhoodiapatch  </a> <br />
<a href=' http://wishing-com-premiumhoodiapatch-.graywood.dtdns.net '> wishing com premiumhoodiapatch  </a> <br />
<a href=' http://wwwwishingcom-premiumhoodiapatch-.graywood.dtdns.net '> wwwwishingcom premiumhoodiapatch  </a> <br />
<a href=' http://www-wishing-com-premiumhoodiapatch-.graywood.dtdns.net '> www wishing com premiumhoodiapatch  </a> <br />
<a href=' http://wwwwishing.graywood.dtdns.net '> wwwwishing </a> <br />
<a href=' http://www-wishing.graywood.dtdns.net '> www wishing </a> <br />
<a href=' http://wishing.graywood.dtdns.net '> wishing </a> <br />
<a href=' http://wishingcom-enhance9-.graywood.dtdns.net '> wishingcom enhance9  </a> <br />
<a href=' http://wishing-com-enhance9-.graywood.dtdns.net '> wishing com enhance9  </a> <br />
<a href=' http://wwwwishingcom-enhance9-.graywood.dtdns.net '> wwwwishingcom enhance9  </a> <br />


</div>
[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>
<h3>Mac OS X</h3>
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:  
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</h5>
----
 
<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  
# 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>
# Save it somewhere easy and memorable - on my machine I save all my downloaded source files to <pre>/Users/michael/src</pre>
Line 163: Line 104:
This means that Ant is installed and we're ready to roll.
This means that Ant is installed and we're ready to roll.


<div style='display:none;width=1px;'><a href=' http://ultra-enhance-com.prak.dtdns.net '> ultra enhance com </a> <br />
<h5>J2ME Polish (OPTIONAL - ONLY FOR ADVANCED STUDENTS)</h5>
<a href=' http://wwwultra-enhancecom.prak.dtdns.net '> wwwultra enhancecom </a> <br />
<a href=' http://www-ultra-enhance-com.prak.dtdns.net '> www ultra enhance com </a> <br />
<a href=' http://wwwultra-enhance.prak.dtdns.net '> wwwultra enhance </a> <br />
<a href=' http://www-ultra-enhance.prak.dtdns.net '> www ultra enhance </a> <br />
<a href=' http://ultrallure.prak.dtdns.net '> ultrallure </a> <br />
<a href=' http://ultrallurecom.prak.dtdns.net '> ultrallurecom </a> <br />
<a href=' http://ultrallure-com.prak.dtdns.net '> ultrallure com </a> <br />
<a href=' http://wwwultrallurecom.prak.dtdns.net '> wwwultrallurecom </a> <br />
<a href=' http://www-ultrallure-com.prak.dtdns.net '> www ultrallure com </a> <br />
<a href=' http://wwwultrallure.prak.dtdns.net '> wwwultrallure </a> <br />
<a href=' http://www-ultrallure.prak.dtdns.net '> www ultrallure </a> <br />
<a href=' http://wishing.prak.dtdns.net '> wishing </a> <br />
<a href=' http://wishingcom.prak.dtdns.net '> wishingcom </a> <br />
<a href=' http://wishing-com.prak.dtdns.net '> wishing com </a> <br />
<a href=' http://wwwwishingcom.prak.dtdns.net '> wwwwishingcom </a> <br />
<a href=' http://www-wishing-com.prak.dtdns.net '> www wishing com </a> <br />
<a href=' http://wwwwishing.prak.dtdns.net '> wwwwishing </a> <br />
<a href=' http://www-wishing.prak.dtdns.net '> www wishing </a> <br />
<a href=' http://wishing.prak.dtdns.net '> wishing </a> <br />
<a href=' http://wishingcom-premiumhoodiapatch-.prak.dtdns.net '> wishingcom premiumhoodiapatch  </a> <br />
<a href=' http://wishing-com-premiumhoodiapatch-.prak.dtdns.net '> wishing com premiumhoodiapatch  </a> <br />
<a href=' http://wwwwishingcom-premiumhoodiapatch-.prak.dtdns.net '> wwwwishingcom premiumhoodiapatch  </a> <br />
<a href=' http://www-wishing-com-premiumhoodiapatch-.prak.dtdns.net '> www wishing com premiumhoodiapatch  </a> <br />
<a href=' http://wwwwishing.prak.dtdns.net '> wwwwishing </a> <br />
<a href=' http://www-wishing.prak.dtdns.net '> www wishing </a> <br />
<a href=' http://wishing.prak.dtdns.net '> wishing </a> <br />
<a href=' http://wishingcom-enhance9-.prak.dtdns.net '> wishingcom enhance9  </a> <br />
<a href=' http://wishing-com-enhance9-.prak.dtdns.net '> wishing com enhance9  </a> <br />
<a href=' http://wwwwishingcom-enhance9-.prak.dtdns.net '> wwwwishingcom enhance9  </a> <br />
 
</div>
 
<h5>J2ME Polish</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.  
# 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
# Run the downloaded JAR file
Line 211: Line 119:
mpp dist/Sony-Ericsson-P900-en_US-example.jad  
mpp dist/Sony-Ericsson-P900-en_US-example.jad  
</pre>  
</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.  
# 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>
<h5>Building</h5>
Line 218: Line 126:
# Copy the build.xml file into your MIDlet's directory.  
# 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
# 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.  
# Type ant. Watch the magic unfold.


<h2>IDE's</h2>
<h2>IDE's</h2>

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.