tag:blogger.com,1999:blog-5209778108692585660.post-83831079245086773942007-08-24T10:56:00.000+05:302007-08-29T17:00:08.726+05:30Java ME Beginners Tutorial : WTK Explained<span class="dropcaps">T</span><br />his is third part of the "Java ME Beginners Tutorial" series. If you haven't read the previous parts you can begin <a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html">here (Java ME Beginners Tutorial : Introduction)</a>.<br><br />This section explains in-depth about the Sun's Wireless Tool kit(WTK). We have already discussed the <a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-installation.html">Installation of WTK</a>.<br /><span id="fullpost"><br />When you install WTK seven menu entries are made for you. They are:<br /><ul><br /><li>Default Device Selection<br /><li>Documentation<br /><li>OTA Provisioning<br /><li>Preferences<br /><li>Run MIDP Application<br /><li>Utilities<br /><li>Wireless Toolkit 2.5<br /></ul><br /><h3>Default Device Selection</h3><br /><br><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/default-device.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/default-device.JPG" border="0" alt="" /></a><br /><br><br />After you write your code and compile it, you will be emulating the behavior of your application using an emulator that's built into the WTK. This avoids the need for a physical mobile device to install and test your app each time you make a modification. Since there are a wide variety of mobile devices on the market each with a different look and feel, WTK provides us with four different emulators each having a different screen size and look and feel.<br><br />The "Default Device Selection" menu entry points to <INSTALLDIR>\bin\DefaultDevicew.exe. It is a simple utility which enables us to make a particular emulator as our default emulator. <br /><br /><h3>Documentation</h3><br />An excellent documentation for the Wireless Tool Kit. It also includes the API reference for CLDC, MIDP and a number of other popular packages. (Don't worry if you don't understand what's CLDC and MIDP. It will be explained later). Go throught the FAQ section in the documentation. It is a must read!<br /><br /><h3>OTA Provisioning</h3><br />The Java ME platform has the ability to download and install a Java application over a wireless network (usually on demand). This is called OTA(Over The Air installation) For this, after developing the application we need to place the application on a special server. Once we have done this, we can use the WTK emulator to download and install the application. If OTA works fine in emulator it ought to work fine in an actual mobile device.<br /><br />The "OTA Provisioning" menu entry points to <INSTALLDIR>\bin\emulatorw.exe -Xjam. That is, it invokes the emulator with a particular command line switch "-Xjam". It displays the default emulator as shown below.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/ota-provisioning.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/ota-provisioning.JPG" border="0" alt="" /></a><br />Select "Apps" and then Menu -> Launch.<br />You will see a text entry where you can give the web address of your application to be installed.<br /><br /><h3>Preferences</h3><br /><br><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-preferences.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/wtk-preferences.JPG" border="0" alt="" /></a><br /><br><br />The menu entry "Preferences" points to <INSTALLDIR>\bin\prefsw.exe. The preferences window allows you to change many configuration settings of the Tool kit. These include the Network Proxy, the heap size available,adjusting emulator performance, enabling memory and network monitoring, enabling profiling, tracing, changing the emulator's storage space etc.<br /><br /><h3>Utilities</h3><br /><br><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-utilities.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/wtk-utilities.JPG" border="0" alt="" /></a><br /><br><br />The "Utilities" menu entry points to <INSTALLDIR>\bin\utilsw.exe. It is similar to the Windows Control Panel as it is a collection of multiple utility programs. It contains utilities like the Database Cleaner which removes all database records in the default emulator, the memory & network monitor, the profiler, midlet signing utility etc.<br /><br /><h3>Wireless Toolkit 2.5</h3><br /><br><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-screen.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/wtk-screen.JPG" border="0" alt="" /></a><br /><br><br />This is the most important one. It points to <INSTALLDIR>\bin\ktoolbar.exe. It is important because we use it to perform all major tasks in Java ME application developing - compiling, packaging and testing (and more).<br /><br><br />An important thing to know is that WTK is not an <a href="http://en.wikipedia.org/wiki/Integrated_development_environment">IDE</a>. It doesn't have any means for code editing. You will have to use an external text editor like notepad for creating .java files. <br><br />We can classify the main window into three parts:<br /><ol><br /><li>Menu Bar<br /><li>Tool Bar<br /><li>Console Area<br /></ol><br />This have been marked in the figure:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-screen_markings.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/wtk-screen_markings.JPG" border="0" alt="" /></a><br />How to use WTK will be discussed as we begin coding.<br /><table width="100%"><br /><tr><br /> <td align="left"><a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-installation.html">Previous:Installation</a></td><br /> <td align="center"><a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-table-of.html">Table of Contents</a></td><br /> <td align="right"><a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-java-me.html">Next:Java ME Basics</a></td><br /></tr><br /></table><br /></span>Anoop Engineernoreply@blogger.com