<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;C0UMQHY6fyp7ImA9WxBbEEs.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660</id><updated>2010-03-08T20:44:41.817+05:30</updated><title>The Java ME Blog</title><subtitle type="html">Java ME | Tips | Tutorials | Hacks</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.javameblog.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.javameblog.com/" /><link rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default?start-index=11&amp;max-results=10&amp;redirect=false&amp;v=2" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>46</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>10</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/JavaMeBlog" /><feedburner:info uri="javameblog" /><feedburner:emailServiceId>JavaMeBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;AkQGSHs7eyp7ImA9WxRQE0g.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-3073885279445730862</id><published>2007-12-13T22:52:00.001+05:30</published><updated>2008-10-07T11:15:29.503+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-07T11:15:29.503+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Presentation" /><category scheme="http://www.blogger.com/atom/ns#" term="Beginners" /><title>Java ME: An Introduction [Presentation]</title><content type="html">&lt;div style="width:425px;text-align:left" id="__ss_201439"&gt;&lt;object style="margin:0px" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=java-me-an-introduction-wwwjavameblogcom-1197507282658934-3"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=java-me-an-introduction-wwwjavameblogcom-1197507282658934-3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"&gt;&lt;a href="http://www.slideshare.net/?src=embed"&gt;&lt;img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This is a presentation that I made, which will help anyone new to Java ME platform as a gentle introduction guide. Please comment your opinion.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-3073885279445730862?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KkkbOy8WF4m0QSm3OMTz4svsyD0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KkkbOy8WF4m0QSm3OMTz4svsyD0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KkkbOy8WF4m0QSm3OMTz4svsyD0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KkkbOy8WF4m0QSm3OMTz4svsyD0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=yH9UndWb"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=Mst8Qfj3"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=imRPFHEb"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=imRPFHEb" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=hoNPmp7c"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=Zfg9OTRY"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=ODhbOlSZ"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=ODhbOlSZ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=FRd4gvgi"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/_jNm0VnrsCo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/3073885279445730862/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=3073885279445730862" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/3073885279445730862?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/3073885279445730862?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/_jNm0VnrsCo/this-is-presentation-that-i-made-to.html" title="Java ME: An Introduction [Presentation]" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">5</thr:total><feedburner:origLink>http://www.javameblog.com/2007/12/this-is-presentation-that-i-made-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UMRH4ycSp7ImA9WxRbGEs.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-688793995929130178</id><published>2007-12-13T21:43:00.000+05:30</published><updated>2008-12-10T04:58:05.099+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-10T04:58:05.099+05:30</app:edited><title>How to get the IP Address of a mobile using Java ME?</title><content type="html">&lt;img style="float:left; margin:0 10px 10px 0;" src="http://4.bp.blogspot.com/_B0CuCDv4i18/R2FbOnLqc5I/AAAAAAAAAII/LpPnsoeZ-sU/s320/sweethome.jpg" border="0" alt="IP Address of mobile phone using Java ME/ J2ME"id="BLOGGER_PHOTO_ID_5143492556028015506" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="dropcaps"&gt;T&lt;/span&gt;here are many situations where you may want to know your phone's IP Address. You know that your mobile connects over GPRS which in turn is based on Internet Protocol, so you are pretty confident that the phone has an IP Address.&lt;br /&gt;Well then, there is a good news and a bad news for you. The good news is that your phone do have an IP Address. The bad news is that this IP address will be hardly usefull for you. Why? read on.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_B0CuCDv4i18/R2FcqHLqc8I/AAAAAAAAAIc/YOUIU2nhwII/s1600-h/JavaME-NAT.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_B0CuCDv4i18/R2FcqHLqc8I/AAAAAAAAAIc/YOUIU2nhwII/s400/JavaME-NAT.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5143494127986045890" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The above image shows the network layout of most mobile based IP connection. Your mobile handset will be connected to the service provider's NAT gateway. The IP that your mobile handset get is a private IP, means that this IP can't be reached from external world.&lt;br /&gt;&lt;br /&gt;There are ways to get both your private IP and the IP Address of the NAT gateway.&lt;br /&gt;&lt;br /&gt;Getting your IP Address&lt;br /&gt;1)The following snippet will give you your private IP Address.&lt;br /&gt;&lt;div class="important"&gt;&lt;br /&gt;ServerSocketConnection scn = (ServerSocketConnection)Connector.open("socket://:1234");&lt;br /&gt;System.out.println(scn.getLocalAddress());&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Note: This method may return your IP Address as 127.0.0.1 (the loopback address) if the GPRS link has been idle. So always send some data over the connection before testing this.&lt;br /&gt;&lt;br /&gt;2)Using the System properties&lt;br /&gt;&lt;div class="important"&gt;&lt;br /&gt;System.getProperty("microedition.hostname");&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;This is supposed to give you the IP Address. But for me this returns 127.0.0.1 always. If you had any success with this, please share in the comments.&lt;br /&gt;&lt;br /&gt;3)This is a bit round about method, but is the most guarenteed to work one. If you are trying to connect to your custom server, have the server tell your ip to you. Implement a handshake  protocol, where you say "Hello server" and the server replies "Hello client. Your IP is xx.xx.xx.xx". &lt;br /&gt;&lt;br /&gt;Getting the IPAddress of the NAT gateway&lt;br /&gt;&lt;br /&gt;Service like http://whatismyipaddress.com/ or http://www.lawrencegoetz.com/programs/ipinfo/ or http://www.whatismyip.com/ gives the IP Address it sees when you browse their pages. This will be your NAT IP Address. Just parse the page and get the IP.&lt;br /&gt;&lt;br /&gt;Remember all these works only if you are using GPRS/Wifi. If you want to know the IP address it need to be a IP based network.&lt;br /&gt;If all you want is a unique number to identify your mobile, read this post on using IMEI number&lt;br /&gt;&lt;br /&gt;Post your success stories and failure in the comments. Let me know how much this post helped you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-688793995929130178?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0YIy3dpVWrkDtY36DOVfnry9XJg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0YIy3dpVWrkDtY36DOVfnry9XJg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0YIy3dpVWrkDtY36DOVfnry9XJg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0YIy3dpVWrkDtY36DOVfnry9XJg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=QFfNbuCO"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=ZQ0CpG4W"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=DIL6yVBE"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=DIL6yVBE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=g6ICzka6"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=Bisp8bNz"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=1ogUPPv0"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=1ogUPPv0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=sBPpoAf6"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/ddv1Pcb-tx0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/688793995929130178/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=688793995929130178" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/688793995929130178?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/688793995929130178?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/ddv1Pcb-tx0/how-to-get-ip-address-of-mobile-using.html" title="How to get the IP Address of a mobile using Java ME?" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_B0CuCDv4i18/R2FbOnLqc5I/AAAAAAAAAII/LpPnsoeZ-sU/s72-c/sweethome.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">8</thr:total><feedburner:origLink>http://www.javameblog.com/2007/12/how-to-get-ip-address-of-mobile-using.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkINRH8-eyp7ImA9WB9XE0g.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-2398649888378810242</id><published>2007-11-06T17:09:00.000+05:30</published><updated>2007-11-06T17:33:15.153+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-11-06T17:33:15.153+05:30</app:edited><title>How to create serial numbers unique to a mobile. (Using IMEI number)</title><content type="html">&lt;span class="dropcaps"&gt;G&lt;/span&gt;ames and most applications in the Windows world come with a&lt;br /&gt;trial period, during which you can test the application. If you find the&lt;br /&gt;application to your taste, you can purchase the full application, which is&lt;br /&gt;usually a simple serial key to unlock the application.&lt;br /&gt;&lt;br /&gt;There have been several attempts to adapt such a method to&lt;br /&gt;the mobile programming world. However, it’s not easy to generate a foolproof&lt;br /&gt;method as the computing power required to generate a strong hash (read as&lt;br /&gt;serial number) or to verify it, is limited in a mobile device.&lt;span id="fullpost"&gt; The major&lt;br /&gt;difficulty lies in generating a number, which is unique to a mobile.&lt;br /&gt;&lt;br /&gt;But Hey, we don’t want to *create* a new number. We already&lt;br /&gt;have a unique number for every device, which is the IMEI number. Why not use&lt;br /&gt;that?&lt;br /&gt;&lt;br /&gt;The only difficulty is that Java ME doesn’t expose any&lt;br /&gt;standard API to get the IMEI number of the device. However, most manufactures allow&lt;br /&gt;us to get the IMEI number using the System.getProperty() method. Here is a HowTo:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Nokia&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;System.getProperty("phone.imei");&lt;br /&gt;System.getProperty("com.nokia.IMEI");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sony-Ericsson&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;System.getProperty("com.sonyericsson.imei");&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Samsung&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;System.getProperty("com.samsung.imei");&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Siemens&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;System.getProperty("com.siemens.imei");&lt;br /&gt;&lt;br /&gt;thanks: &lt;a href="http://mobilepit.com/10/how-to-get-imei-number-in-j2me-javame.html"&gt;mypapit&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-2398649888378810242?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xB_IPyalx-RT9VRy-NC1tplu7Dc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xB_IPyalx-RT9VRy-NC1tplu7Dc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xB_IPyalx-RT9VRy-NC1tplu7Dc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xB_IPyalx-RT9VRy-NC1tplu7Dc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=84VKnzbk"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=P9GpUTta"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=lADDXDol"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=lADDXDol" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=UP5BeTqr"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=YNV6pOem"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=u47jPbCe"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=u47jPbCe" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=4vjng9TJ"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/I9j7i7-s3_g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/2398649888378810242/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=2398649888378810242" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/2398649888378810242?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/2398649888378810242?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/I9j7i7-s3_g/how-to-create-serial-numbers-unique-to.html" title="How to create serial numbers unique to a mobile. (Using IMEI number)" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total><feedburner:origLink>http://www.javameblog.com/2007/11/how-to-create-serial-numbers-unique-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUGQ3gzeip7ImA9WB5bFUg.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-2516025083308531394</id><published>2007-08-31T11:25:00.000+05:30</published><updated>2007-08-31T15:27:02.682+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-31T15:27:02.682+05:30</app:edited><title>Java ME Advanced Tutorial: GUI Programming Part 1</title><content type="html">&lt;span class="dropcaps"&gt;S&lt;/span&gt;&lt;br /&gt;o you are determined in becoming an 31337 Java ME guru, as is evident that you have begun reading the "Java ME Advanced Tutorial" series. If you haven't read the "&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;Java ME Beginner's Tutorial&lt;/a&gt;" series, now would be a good time to &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt; skim through it&lt;/a&gt;.   By the time you start the advanced tutorials, you should be well versed with &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-wtk.html"&gt;using Wireless Tool Kit&lt;/a&gt;, &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-java-me.html"&gt;Java ME Basics&lt;/a&gt;, &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-writing.html"&gt;writing code and building it&lt;/a&gt; and &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-packaging.html"&gt;packaging&lt;/a&gt; it. Now we are going into advanced areas of Java ME technology. Let's begin with GUI programming.&lt;br /&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;h3&gt;Little Background Info&lt;/h3&gt;&lt;br /&gt;The first version of Java released outside Sun was Java 1.0.2. This initial version itself contained &lt;a href="http://java.sun.com/products/jdk/awt/"&gt;AWT&lt;/a&gt;(Abstract Windowing Toolkit), which was a means to develop Graphical User Interface (GUI) applications. Later came &lt;a href="http://java.sun.com/docs/books/tutorial/ui/overview/intro.html"&gt;Swing&lt;/a&gt;, which was a better AWT than AWT.&lt;br /&gt;&lt;br /&gt;Java ME do not use AWT or Swing. Instead it defines its own GUI classes which are part of the MIDP api. Reason for not using AWT or Swing are:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;AWT and Swing are designed with desktop computers in mind. They are windowing elements for a screen with a higher resolution and capabilities than a mobile phone's screen.&lt;br /&gt;&lt;li&gt;AWT and Swing are supposed to work with a pointing device such as a mouse. Most mobile phones however do not have such a pointing device.&lt;br /&gt;&lt;li&gt;Most of the features that the AWT and Swing supports, such as the Window Mangement and overlapping windows, are impractical and impossible on a mobile device.&lt;br /&gt;&lt;li&gt;AWT and Swing creates event objects during runtime for each GUI event such as mouse-move and button-click. These objects exists only till the event is processed and is later freed during garbage collection. However, the limited processing power and memory of mobile device cannot handle such a heavy process.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span class="pullquote"&gt;&lt;br /&gt;Classes for GUI programming are defined within the MIDP APIs.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Due to these reasons MIDP decided to have its own set of GUI APIs. These APIs are classified as &lt;span style="font-weight:bold;"&gt;high level&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;low level&lt;/span&gt; APIs. Both the high level and low level APIs come in the &lt;span style="font-weight:bold;"&gt;javax.microedition.lcdui&lt;/span&gt; package.&lt;br /&gt;&lt;br /&gt;Anything that can be displayed is represented by the &lt;span style="font-style:italic;"&gt;Diplayable&lt;/span&gt; class. The &lt;span style="font-style:italic;"&gt;Screen &lt;/span&gt;class is a sub-class of the Displayable class and represent screens that occupy the full screen area. There are three types of screens:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Screens that have a predefined structure and is indented for a specific purpose. You cannot add any other components to these screens. eg: List, TextBox etc.&lt;br /&gt;&lt;li&gt;General purpose screens made using the Form component. You can add other components to this Form creating custom screens of your desire.&lt;br /&gt;&lt;li&gt;Screens created using low-level APIs; as a subclass of Canvas, GameCanvas etc. If you are interested in mobile game programming, this is the stuff you need to learn more thoroughly.&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;The first step in GUI programming is to get the &lt;span style="font-style:italic;"&gt;display&lt;/span&gt; object. Yes, as you might have guessed, the display object represent the display of the mobile device. The general routine in GUI programming is:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;Get the display object:&lt;/span&gt; There is a class named &lt;span style="font-style:italic;"&gt;Display &lt;/span&gt;in the javax.microedition.lcdui package. We use a static method named getDisplay() to get the display object.&lt;br /&gt;&lt;blockquote&gt;public static Display getDisplay(Midlet midlet);&lt;/blockquote&gt;&lt;br /&gt;&lt;div class="important"&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Things to remember:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;A MIDlet can have only one instance of display object.&lt;br /&gt;&lt;li&gt;Display.getDisplay() can be called multiple times;however, all calls will return the reference to the same object.&lt;br /&gt;&lt;li&gt;Do NOT call getDisplay() in the MIDlet's constructor, as the display might not be initialized then.&lt;br /&gt;&lt;li&gt;A better approach would be to call it in startApp() method.&lt;br /&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;Create a screen object:&lt;/span&gt; The different types of the screen objects and their behavior will come later in this tutorial series.&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt; Show the &lt;span style="font-style:italic;"&gt;screen&lt;/span&gt; on the &lt;span style="font-style:italic;"&gt;display&lt;/span&gt;:&lt;/span&gt;For this we use the setCurrent() method of the Display class.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;public void setCurrent(Displayable nextDisplayable);&lt;br /&gt;public void setCurrent(Alert alert, Displayable nextDisplayable);&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Display class - In detail&lt;/h3&gt;&lt;br /&gt;We have already seen some of the methods in the Display class: getDisplay() and setCurrent(). Some other most useful methods are discussed here:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;getCurrent():&lt;/span&gt; &lt;br /&gt;&lt;blockquote&gt;public Displayable getCurrent()&lt;/blockquote&gt;&lt;br /&gt;This returns the Displayable object that is currently being displayed on the screen. If you call this before setting a screen using setCurrent, it will return NULL. &lt;br /&gt;If the screen is hidden by a system screen(such as a low battery Alert screen), still getCurrent() will return the Displayable that was last set using setCurrent().&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;isColor():&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;public boolean isColor()&lt;/blockquote&gt;&lt;br /&gt;This returns true, if the phone is a color phone. Else, this returns false.&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;numColors():&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;public int numColors()&lt;/blockquote&gt;&lt;br /&gt;This returns the number of colors if the phone is a color phone. Otherwise, it returns the number of gray levels supported.&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;setCurrentItem():&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;public void setCurrentItem(Item item)&lt;/blockquote&gt;&lt;br /&gt;This is a very useful method when you are using forms. Suppose you have a form with two TextEntries - Name and Password, and you wish that the cursor be in the Name field when the form is displayed. All you have to do is : d.setCurrentItem(name);&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;vibrate():&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;public boolean vibrate(int duration)&lt;/blockquote&gt;&lt;br /&gt;This method can be used to enable and disable the vibrator of a phone. If the phone doesn't support vibration or if your display is not in the foreground then this call returns false. Otherwise it returns true. This method returns immediately and is not a blocking call. It accepts the time in milliseconds for which the vibrator should be active. However, the implementation can limit or override this duration. If this parameter is zero, vibrator is stopped.&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;flashBacklight():&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;public boolean flashBacklight(int duration)&lt;/blockquote&gt;&lt;br /&gt;This is very much similar to the vibrate() call. It is used to turn on and off the devices' flashlight repeatedly for the duration specified in the parameter. If the parameter is zero the light is turned off immediately. This method is non blocking and returns false if the display is not in the foreground or if the back light cannot be controlled by application. Else it returns true.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;In the next section, we begin with the high level api.&lt;br /&gt;&lt;div style="float:right;"&gt;&lt;br /&gt;&lt;a href="xxxxxxxx"&gt;Next: TOFOTOTO &gt;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="float:left;"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-advanced-tutorial-table-of.html"&gt;&lt;&lt; Java ME Advanced Tutorial: Table Of Contents&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-2516025083308531394?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/h0kHw_W1Bw3c1K93TxRjI4EAeBk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/h0kHw_W1Bw3c1K93TxRjI4EAeBk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/h0kHw_W1Bw3c1K93TxRjI4EAeBk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/h0kHw_W1Bw3c1K93TxRjI4EAeBk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=UTGeHIGj"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=qgpOqAc8"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=VpTo6Ng4"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=VpTo6Ng4" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=EG5K474n"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=LnVXVIK5"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=waMI7BX3"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=waMI7BX3" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=45VLpcxF"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/iYnWLehm7go" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/2516025083308531394/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=2516025083308531394" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/2516025083308531394?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/2516025083308531394?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/iYnWLehm7go/java-me-advanced-tutorial-gui.html" title="Java ME Advanced Tutorial: GUI Programming Part 1" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://www.javameblog.com/2007/08/java-me-advanced-tutorial-gui.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcDQ3s-fip7ImA9WB5bFUg.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-4150082781269348613</id><published>2007-08-31T11:21:00.000+05:30</published><updated>2007-08-31T15:24:32.556+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-31T15:24:32.556+05:30</app:edited><title>Java ME Advanced Tutorial: Table Of Contents</title><content type="html">&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-advanced-tutorial-gui.html"&gt;Chapter 1 : GUI Programming Part 1&lt;/a&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-4150082781269348613?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1P-CVbm4LTuMXfBTSruI_5uH4rA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1P-CVbm4LTuMXfBTSruI_5uH4rA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1P-CVbm4LTuMXfBTSruI_5uH4rA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1P-CVbm4LTuMXfBTSruI_5uH4rA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=xMr3qA6F"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=JEytXpEx"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=hedU5Bn7"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=hedU5Bn7" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=MHgsNjrB"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=Rng8eMGI"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=dLZDDmjs"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=dLZDDmjs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=a7T8HTpO"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/ZhPstuSY-dg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/4150082781269348613/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=4150082781269348613" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/4150082781269348613?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/4150082781269348613?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/ZhPstuSY-dg/java-me-advanced-tutorial-table-of.html" title="Java ME Advanced Tutorial: Table Of Contents" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">7</thr:total><feedburner:origLink>http://www.javameblog.com/2007/08/java-me-advanced-tutorial-table-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEFQno5fCp7ImA9WB5bFEo.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-3425188490333479850</id><published>2007-08-30T14:24:00.000+05:30</published><updated>2007-08-30T17:20:13.424+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-30T17:20:13.424+05:30</app:edited><title>Java ME Beginners Tutorial : Packaging</title><content type="html">&lt;span class="dropcaps"&gt;W&lt;/span&gt;&lt;br /&gt;elcome to the sixth chapter of the "Java ME Beginners Tutorial" series.&lt;br /&gt;&lt;br /&gt;Success of any software application largely depends on the ease of its installation. There should be a standard way of packaging your application; a form which is easy to send over a network, and one which is easy to install. In Windows there is the .msi packages (setup.exe?) and in Linux we have the RPMs and DEBs.&lt;br /&gt;&lt;br /&gt;In the Java ME arena, the packages are called "MIDlet Suites".&lt;br /&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;Midlet Suites can contain more than one MIDlets. A MIDlet Suite is not a single file, but a group of two files: JAD file and a JAR file.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;JAD File&lt;/h3&gt;&lt;br /&gt;JAD stands for "Java Application Descriptor" and is a simple text file. If you have &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-installation.html"&gt;installed WTK&lt;/a&gt; and followed the &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-writing.html"&gt;exercise in our last chapter&lt;/a&gt;, you will find a JAD file in your [INSTALLDIR]\apps\JavaMEBlog\bin directory. Open JavaMEBlog.jad using Notepad and you can see the following contents:&lt;br /&gt;&lt;blockquote&gt;MIDlet-1: JavaMEBlog, JavaMEBlog.png, HelloMIDlet&lt;br /&gt;MIDlet-Jar-Size: 887&lt;br /&gt;MIDlet-Jar-URL: JavaMEBlog.jar&lt;br /&gt;MIDlet-Name: JavaMEBlog&lt;br /&gt;MIDlet-Vendor: Unknown&lt;br /&gt;MIDlet-Version: 1.0&lt;br /&gt;MicroEdition-Configuration: CLDC-1.1&lt;br /&gt;MicroEdition-Profile: MIDP-2.1&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This is a JAD file that WTK made for us. The contents of JAD file is arranged in the form of property:value. The valid properties that can come in a JAD file are:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Name&lt;/span&gt;: This is the name of the MIDlet suite (Do not confuse it with name of individual MIDlets contained in the suite).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Version&lt;/span&gt;: Version of the MIDlet Suite.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Vendor&lt;/span&gt;: The name of the person or the company which developed the MIDlet Suite.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Icon&lt;/span&gt;: Every MIDlet Suite has an icon that appears in the phone menu when the suite is installed. This enables the user to easily identify an application. The value of this property should be the name of the icon. Icons have to be stored in the &lt;span style="font-weight:bold;"&gt;res&lt;/span&gt; folder within the project directory.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Description&lt;/span&gt;: A short description of the MIDlet suite.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Info-URL&lt;/span&gt;: A url that gives more information about the MIDlet Suite.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-&lt;n&gt;&lt;n&gt;&lt;/n&gt;&lt;/span&gt;: As mentioned, a MIDlet suite can contain more than one MIDlet. For each MIDlet present, there should be a corresponding MIDlet-1, MIDlet-2 etc entry made in the JAD file. The value of this will contain the MIDlet name, Icon for this MIDlet and the MIDlet class name.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Jar-URL&lt;/span&gt;: URL of the JAR file&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Jar-Size&lt;/span&gt;: Size of the JAR file in bytes.&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MIDlet-Data-Size&lt;/span&gt;: The minimum number of bytes required for persistent data storage.&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MicroEdition-Profile&lt;/span&gt;: What J2ME Profile is required by the MIDlet.&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MicroEdition-Configuration&lt;/span&gt;: What J2ME Configuration is required by the MIDlet.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Not all of these properties are compulsory, but the following are :&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;MIDlet-Name&lt;br /&gt;&lt;li&gt;MIDlet-Version&lt;br /&gt;&lt;li&gt;MIDlet-Vendor&lt;br /&gt;&lt;li&gt;MIDlet-&lt;n&gt; for each MIDlet in the JAR file&lt;br /&gt;&lt;li&gt;MicroEdition-Profile&lt;br /&gt;&lt;li&gt;MicroEdition-Configuration&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;JAR File&lt;/h3&gt;&lt;br /&gt;JAR stands for "Java Archive". A JAR file is a compressed zip file which will contain compiled class files, icons, images and other resources that the application requires during runtime. Since it is a zip file, you can open and inspect it using any zip utility like WinZip. To create a JAR file select &lt;span style="font-weight:bold;"&gt;Project &lt;/span&gt;-&gt; &lt;span style="font-weight:bold;"&gt;Package &lt;/span&gt;-&gt; &lt;span style="font-weight:bold;"&gt;Create Package&lt;/span&gt; from the menu bar. This will create a new JAD and JAR file in the [PROJECTDIR]\bin folder.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk_screen_create_package.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/wtk_screen_create_package.JPG" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Every JAR file will contain a folder named "META-INF" and file named "Manifest.mf" inside this folder. Manifest.mf is again a text file and if you open it using a text editor, you can see that it very much resembles the JAD file. All the JAD file properties that we used earlier can be added to the Manifest file also. The value of compulsory properties like MIDlet-Name, MicroEdition-Profile, MicroEdition-Configuration etc has to match in both the manifest file and JAD file. Other properties can differ between Manifest and JAD file, but in such a case the values in the JAD file is taken.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--&lt;h3&gt;Obfustication&lt;/h3&gt;--&gt;&lt;br /&gt;&lt;table width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-writing.html"&gt;Previous:Writing the first MIDlet&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-table-of.html"&gt;Table of Contents&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-wtk.html"&gt;Next:TODO TODO&lt;/a&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-3425188490333479850?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lgvTb1ujYOXliwou60l6KbHvESI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lgvTb1ujYOXliwou60l6KbHvESI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lgvTb1ujYOXliwou60l6KbHvESI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lgvTb1ujYOXliwou60l6KbHvESI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=3EGB24tp"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=8QuQ7mFq"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=zkeWj6IE"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=zkeWj6IE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=sMcl5aaM"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=9UtRjaRu"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=9KuYvMfG"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=9KuYvMfG" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=PDKEcE28"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/JSIn4getzYs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/3425188490333479850/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=3425188490333479850" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/3425188490333479850?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/3425188490333479850?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/JSIn4getzYs/java-me-beginners-tutorial-packaging.html" title="Java ME Beginners Tutorial : Packaging" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://www.javameblog.com/2007/08/java-me-beginners-tutorial-packaging.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUMSX08cSp7ImA9WB5bFEo.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-1668874691303157458</id><published>2007-08-29T17:04:00.000+05:30</published><updated>2007-08-30T16:08:08.379+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-30T16:08:08.379+05:30</app:edited><title>Java ME Beginners Tutorial : Writing the first MIDlet</title><content type="html">&lt;span class="dropcaps"&gt;L&lt;/span&gt;&lt;br /&gt;ets get our hands dirty. In this chapter, we are going to write our first MIDlet. This is the fifth chapter in the 'Java ME Beginners Tutorial' series.&lt;br/&gt;&lt;br /&gt;By the time you reach here, you are expected to have gone through the &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;introduction&lt;/a&gt;, &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-installation.html"&gt;installed WTK&lt;/a&gt; on your work machine and &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-wtk.html"&gt;learned about it&lt;/a&gt;. We also had a &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-java-me.html"&gt;brief look into the Java ME world&lt;/a&gt;. In this chapter we will begin coding.&lt;br /&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;If you remember earlier chapters, it was said that Wireless Tool Kit is not an IDE. There is no facility to edit and indent code. So we have to use a text editor for this purpose. For the purpose of this tutorial, we will use Notepad available in windows (Linux users have a myriad of options: vi, emacs, gedit, kate, kwrite etc etc...).&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 1&lt;/h3&gt;&lt;br /&gt;Fire up WTK (Start -&gt; All Programs -&gt;Sun Java(TM) Wireless Toolkit 2.5 for CLDC -&gt;Wireless Toolkit 2.5 or [INSTALLDIR]\bin\ktoolbar.exe). Then select "New Project" from the toolbar.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-screen_new_project.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/wtk-screen_new_project.JPG" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You will get a dialog box asking for Project Name and Midlet class name, as shown below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/new_project_dialog.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/new_project_dialog.JPG" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Provide "JavaMEBlog" as the project name and "HelloMIDlet" as the class name and click "Create Project". You will get a settings page. This is the configuration page where you can edit the settings of your project. The default settings will work for us, so click "OK". If all went correct, a folder named JavaMEBlog would have been created in the [INSTALLDIR]\apps\ directory (INSTALLDIR is the place where you installed WTK). This is the main project folder. It contain many sub directories :&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;bin&lt;/strong&gt;:Will contain the binary files: JAD and JAR after compiling the code. (We will see JAD and JAR files later when we discuss "Packaging")&lt;br /&gt;&lt;li&gt;&lt;strong&gt;lib&lt;/strong&gt;:Place the library files(again in JAR format) that the application requires in this directory.&lt;br /&gt;&lt;li&gt;&lt;strong&gt;res&lt;/strong&gt;: Place resources like icons, images, audio, video files etc that the application requires during run-time in this directory.&lt;br /&gt;&lt;li&gt;&lt;strong&gt;src&lt;/strong&gt;:The most important directory for the application developer, as this directory contains all the source code.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Step 2&lt;/h3&gt;&lt;br /&gt;Copy-paste the following code into Notepad:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;import javax.microedition.midlet.*;&lt;br /&gt;import javax.microedition.lcdui.*;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class HelloMIDlet extends MIDlet {&lt;br /&gt;    public void startApp() {&lt;br /&gt;        System.out.println("Hello World");&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public void pauseApp() {&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public void destroyApp(boolean unconditional) {&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Now save it as "HelloMIDlet.java". If using Notepad, be careful to make the "save as type" to "All files". Otherwise notepad will name the file as HelloMIDlet.java.txt which is not what we intended. You have to save this file in the &lt;strong&gt;[INSTALLDIR]\apps\JavaMEBlog\src&lt;/strong&gt; directory.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 3&lt;/h3&gt;&lt;br /&gt;Now we can compile the code. Select "Build" from the tool bar. Building is a sequence of two operations: Compiling the code and then preverifying it. If your code was correct you will get the "Build complete" message as shown in the figure.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk_screen_build.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/wtk_screen_build.JPG" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 4&lt;/h3&gt;&lt;br /&gt;Next step is to test the application. We use the Wireless Tool Kit's emulator for this purpose. Select "Run" from the tool bar.&lt;br /&gt;&lt;br /&gt;Our application doesn't do anything useful. All it does is to print "Hello World" in the WTK console and exit (duh!); so there is no point in installing such an application in an actual mobile device since there is no console in mobile devices.&lt;br /&gt;&lt;br /&gt;On running the application, the default emulator will be displayed (which will be Default color phone, if you haven't changed any settings). The application name "JavaMEBlog" will be displayed on the screen. Select "Launch". Since out application doesn't have a GUI, you will not notice any difference in the screen. But the string "Hello World" would be printed on the WTK's console.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Understanding the source code&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;public class HelloMIDlet extends MIDlet {&lt;/blockquote&gt;&lt;br /&gt;Every MIDlet should implement the abstract class &lt;strong&gt;javax.microedition.midlet.MIDlet&lt;/strong&gt;. This class contains three abstract methods that we have to implement: &lt;strong&gt;startApp()&lt;/strong&gt;,&lt;strong&gt;pauseApp()&lt;/strong&gt; and &lt;strong&gt;destroyApp()&lt;/strong&gt;. Every MIDlet is invoked and controlled by the Application Management System (AMS) residing in the mobile phones. The above three methods are special as they are never called by the developer(application) but by the AMS. Whenever the user wishes to run the application, the AMS invokes the startApp() method. When the AMS wishes to pause the application (such as during an incoming call) the pauseApp() method is called. Finally, when the AMS wants to terminate the application, the destroyApp() is called.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;blockquote&gt;public void startApp() {&lt;br /&gt;        System.out.println("Hello World");&lt;br /&gt;    }&lt;/blockquote&gt;&lt;br /&gt;The stuff within the startApp() method will be executed when the application is launched by the user. Here, we have given as simple println statement. The System.out.println() will print to the WTK's console area. So it can be used for testing with an emulator only.&lt;br /&gt;&lt;br /&gt;    &lt;blockquote&gt;public void pauseApp() {&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public void destroyApp(boolean unconditional) {&lt;br /&gt;    }&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;We are not doing anything when pauseApp() or destroyApp() is being called. In actual programming, we will be doing some clean up work (freeing some resources) in these methods. &lt;br /&gt;&lt;br /&gt;Since we have gone through our first code, now is a good time to discuss the life cycle of a MIDlet application.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/midlet_life_cycle.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/midlet_life_cycle.JPG" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There are three states for every MIDlet: Active, Paused and Destroyed. When the MIDlet object is made by calling its constructor, the application is said to be in the &lt;span style="font-style:italic;"&gt;Paused&lt;/span&gt; state. Then the AMS can move the application to &lt;span style="font-style:italic;"&gt;Active&lt;/span&gt; state by calling the startApp() method. From the Active state, the AMS can take the application back to Paused state by calling the pauseApp() method. The thing to remember here is that startApp() and pauseApp() can be called multiple times in an application's life time.&lt;br /&gt;When the AMS wants to terminate the application, it calls the destroyApp() method. destroyApp() accepts a boolean parameter. If this parameter is true, the MIDlet has to compulsorily quit, no matter what it is currently doing. However if this is false, the application can survive termination by throwing a MIDletStateChangeException. If any runtime exception occurs within the destroyApp() method, it is ignored and the application is terminated immediately.&lt;br /&gt; &lt;br /&gt;Next we will discuss how to package the compiled classes to a package so that other people can easily install our application.&lt;br /&gt;&lt;table width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-java-me.html"&gt;Previous: Java ME Basics&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-table-of.html"&gt;Table of Contents&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-packaging.html"&gt;Next: Packaging&lt;/a&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-1668874691303157458?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tHUKGA_MiT6arvywTBmS6VLiVK8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tHUKGA_MiT6arvywTBmS6VLiVK8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tHUKGA_MiT6arvywTBmS6VLiVK8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tHUKGA_MiT6arvywTBmS6VLiVK8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=kR7BCJu8"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=9BUnfW0g"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=zHsko1TY"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=zHsko1TY" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=3004sYvx"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=mUDFzEp6"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=oPi4aTVx"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=oPi4aTVx" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=VUE5pU9N"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/GfPZbZ3cenU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/1668874691303157458/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=1668874691303157458" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/1668874691303157458?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/1668874691303157458?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/GfPZbZ3cenU/java-me-beginners-tutorial-writing.html" title="Java ME Beginners Tutorial : Writing the first MIDlet" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.javameblog.com/2007/08/java-me-beginners-tutorial-writing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcARXk5fip7ImA9WB5bFEk.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-1792416127132245472</id><published>2007-08-24T12:28:00.000+05:30</published><updated>2007-08-30T09:40:44.726+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-30T09:40:44.726+05:30</app:edited><title>Java ME Beginners Tutorial : Java ME Basics</title><content type="html">&lt;span class="dropcaps"&gt;W&lt;/span&gt;&lt;br /&gt;elcome to the fourth part of the "Java ME Beginners Tutorial" series. If you haven't read the previous parts you can begin &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;here (Java ME Beginners Tutorial : Introduction)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;By the time you reach here, you have &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-installation.html"&gt;installed WTK&lt;/a&gt; and &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-wtk.html"&gt;studied it&lt;/a&gt;.So now we have everything we need to get some Java ME gyan. Let’s start.&lt;br /&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;By saying Java ME, we refer to a number of classes, interfaces and a JVM that is needed to run a Java application on mobiles. To make things simple and to bring little peace to this chaotic world, these classes, interfaces and JVM are put into three layers: Configuration, Profile and Optional Packages. Memorize these jargon words; you will not regret doing it when you become ‘the el33t Java ME guru’.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/javamelayers.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://anoopengineer.googlepages.com/javamelayers.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Configuration&lt;/h3&gt;&lt;br /&gt;This is the most underlying layer of Java ME and not surprisingly, it contains the “special” JVM also. Now why do we need a special JVM? Why can’t we reuse the existing JVM that we use in our desktops? The reason is simple: your mobile phone has less computational muscle as compared to a desktop computer. So it simply can’t run the bulky and mighty JVM from the desktop world.&lt;br /&gt;&lt;br /&gt;I said I was lying when I defined Java ME in the &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;introduction&lt;/a&gt;. I said that Java ME is for creating Java programs for mobile phones. Sure!, you can use Java ME technology to develop application for mobile phones, but its scope is not just limited to mobile phones. Java ME is currently used on a multitude device like pagers, set-top boxes, car navigation systems and a number of other embedded systems. The only requirement to use Java ME is that the device should have some sort of connectivity: a powerful Ethernet connection or a weak wireless connection.&lt;br /&gt;There are two types of configuration as of writing this:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;CDC and&lt;br /&gt;&lt;li&gt;CLDC&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;CDC stands for ‘Connected Device Configuration’ and CLDC for ‘Connected Limited Device Configuration’.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CDC aims at devices that are a little bit more powerful than a mobile phone; devices like a Set-top box or a Car Navigation system. I have mentioned that configuration contained the JVM. The virtual machine in CDC is called CVM (Compact Virtual Machine). &lt;br /&gt;&lt;br /&gt;Mobile phones use CLDC as the configuration. The VM used in CLDC is termed KVM (K because it runs on Kilobytes of memory).&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;CVM&lt;/h4&gt;&lt;br /&gt;This VM is a complete clone of the desktop Java JVM. It contains all the power, all the abilities of the former. Only difference is that it can run in a much-restricted environment: restricted memory, restricted computational power, restricted storage facility.&lt;br /&gt;&lt;h4&gt;KVM&lt;/h4&gt;&lt;br /&gt;This is a stripped down version of the desktop VM. It is designed for smaller device like a mobile phone and for a smaller memory footprint. It doesn’t support all features of conventional JVM like the object serialization, finalization etc.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In addition to the JVM the configuration also contains all the classes, interfaces and exceptions that Java ME subsets from Java SE. A list of all classes contained in CLDC can be obtained &lt;a href="http://java.sun.com/javame/reference/apis/jsr139/"&gt;here&lt;/a&gt;.&lt;br /&gt;The configuration used in mobile phones is CLDC, and hence this will be our area of interest.&lt;br /&gt;&lt;h4&gt;CLDC&lt;/h4&gt;&lt;br /&gt;Some of the limitations of the CLDC are given below. A programmer need to be aware of such limitations to avoid serious trouble later on.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;No floating point support.&lt;br /&gt;&lt;li&gt;No object finalization.&lt;br /&gt;&lt;li&gt;No JNI support.&lt;br /&gt;&lt;li&gt;No reflection.&lt;br /&gt;&lt;li&gt;No thread groups and daemon threads.&lt;br /&gt;&lt;li&gt;No application defined class loaders.&lt;br /&gt;&lt;li&gt;Implementation defined error handling.&lt;br /&gt;&lt;li&gt;Class verification is done in a different manner.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Profile&lt;/h3&gt;&lt;br /&gt;A profile extends the configuration. It adds domain specific classes to the core. It is geared towards a specific use of the device. For example, not every device need to have a screen. For devices that have one, the APIs to manage the screen is included in a profile.&lt;br /&gt;&lt;br /&gt;There are different types of profiles like MIDP, Foundation Profile, Personal Profile, Personal Basis Profile etc. The profile used in mobile phones is MIDP, and hence this will be our area of interest.&lt;br /&gt;&lt;h4&gt;MIDP&lt;/h4&gt;&lt;br /&gt;&lt;span class="pullquote"&gt;&lt;br /&gt;Application created using the MIDP API is called a MIDlet.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;M&lt;/strong&gt;obile &lt;strong&gt;I&lt;/strong&gt;nformation &lt;strong&gt;D&lt;/strong&gt;evice &lt;strong&gt;P&lt;/strong&gt;rofile extends the CLDC configuration. JSR 37 introduced MIDP 1.0, while JSR 118 introduced MIDP 2.0.&lt;br /&gt;MIDP 1.0 contained APIs for UI creation, local persistence mechanism, networking and MIDlet life-cycle management. (An application written using MIDP APIs is called a MIDlet). In addition to these, MIDP 2.0 added APIs for a robust security policy, APIS for sound and gaming and extended the networking APIs to include TCP socket streams, UDP datagrams, serial, push-initiated and secure connections.&lt;br /&gt;You may not know a lot of things said above. Don’t worry just read along. You will catch up in no time.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Optional Packages&lt;/h3&gt;&lt;br /&gt;At first, when the 'Sun' god created Java ME platform (then called J2ME) there was only configurations and  profiles. As the platform evolved, god realized that something was missing. There was no way to support new technology. He knew it was not a good practice to throw everything and the kitchen sink into the profiles. So he created optional packages.&lt;br /&gt;&lt;br /&gt;Optional packages are similar to profiles as they are also a set of APIs. They do not have an independent existence of their own. They are always associated with a configuration and a profile. An optional package extend the capabilities of a configuration + profile system.&lt;br /&gt;&lt;br /&gt;An example of an optional package is the MMAPI or the Multimedia API. This API provides support for playing Audio and Video files as well as other features like taking photos using the phones built in camera. However not all mobile phones support  multimedia and not all mobiles will be having a built in camera. So only those phones which support these features will contain the MMAPI support in them.&lt;br /&gt;&lt;br /&gt;An important thing that Java ME developers should know is that application developers have no control over what optional packages are available on a phone. No, we cannot install optional packages in a mobile phone, nor can we bundle our application with an optional package. It is the phone manufactures like Nokia and Motorola that should provide optional packages. If they haven't, then you will have to eat that.&lt;br /&gt;&lt;table width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td align="left"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-wtk.html"&gt;Previous:WTK Explained&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td align="center"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-table-of.html"&gt;Table of Contents&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td align="right"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-writing.html"&gt;Next: Writing the first MIDlet&lt;/a&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-1792416127132245472?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lTj97AQZE56qoCIlgUsqBhB9A8s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lTj97AQZE56qoCIlgUsqBhB9A8s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lTj97AQZE56qoCIlgUsqBhB9A8s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lTj97AQZE56qoCIlgUsqBhB9A8s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=hYqWRhfp"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=goDlm7pK"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=C17mzYUm"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=C17mzYUm" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=0qQZ4V7k"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=ry6Gcbkk"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=22S8Iw9H"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=22S8Iw9H" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=YakQjFnu"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/4kGy9A5vZ4w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/1792416127132245472/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=1792416127132245472" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/1792416127132245472?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/1792416127132245472?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/4kGy9A5vZ4w/java-me-beginners-tutorial-java-me.html" title="Java ME Beginners Tutorial : Java ME Basics" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://www.javameblog.com/2007/08/java-me-beginners-tutorial-java-me.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcESXk5fip7ImA9WB5bE0U.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-8383107924508677394</id><published>2007-08-24T10:56:00.000+05:30</published><updated>2007-08-29T17:00:08.726+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-29T17:00:08.726+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WTK" /><category scheme="http://www.blogger.com/atom/ns#" term="Beginners" /><category scheme="http://www.blogger.com/atom/ns#" term="Java ME" /><title>Java ME Beginners Tutorial : WTK Explained</title><content type="html">&lt;span class="dropcaps"&gt;T&lt;/span&gt;&lt;br /&gt;his is third part of the "Java ME Beginners Tutorial" series. If you haven't read the previous parts you can begin &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;here (Java ME Beginners Tutorial : Introduction)&lt;/a&gt;.&lt;br&gt;&lt;br /&gt;This section explains in-depth about the Sun's Wireless Tool kit(WTK). We have already discussed the &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-installation.html"&gt;Installation of WTK&lt;/a&gt;.&lt;br /&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;When you install WTK seven menu entries are made for you. They are:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Default Device Selection&lt;br /&gt;&lt;li&gt;Documentation&lt;br /&gt;&lt;li&gt;OTA Provisioning&lt;br /&gt;&lt;li&gt;Preferences&lt;br /&gt;&lt;li&gt;Run MIDP Application&lt;br /&gt;&lt;li&gt;Utilities&lt;br /&gt;&lt;li&gt;Wireless Toolkit 2.5&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Default Device Selection&lt;/h3&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/default-device.JPG"&gt;&lt;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="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;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.&lt;br&gt;&lt;br /&gt;The "Default Device Selection" menu entry points to &lt;INSTALLDIR&gt;\bin\DefaultDevicew.exe. It is a simple utility which enables us to make a particular emulator as our default emulator. &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Documentation&lt;/h3&gt;&lt;br /&gt;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!&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;OTA Provisioning&lt;/h3&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;The "OTA Provisioning" menu entry points to &lt;INSTALLDIR&gt;\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.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/ota-provisioning.JPG"&gt;&lt;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="" /&gt;&lt;/a&gt;&lt;br /&gt;Select "Apps" and then Menu -&gt; Launch.&lt;br /&gt;You will see a text entry where you can give the web address of your application to be installed.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Preferences&lt;/h3&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-preferences.JPG"&gt;&lt;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="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;The menu entry "Preferences" points to &lt;INSTALLDIR&gt;\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.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Utilities&lt;/h3&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-utilities.JPG"&gt;&lt;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="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;The "Utilities" menu entry points to &lt;INSTALLDIR&gt;\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 &amp; network monitor, the profiler, midlet signing utility etc.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Wireless Toolkit 2.5&lt;/h3&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-screen.JPG"&gt;&lt;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="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;This is the most important one. It points to &lt;INSTALLDIR&gt;\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).&lt;br /&gt;&lt;br&gt;&lt;br /&gt;An important thing to know is that WTK is not an &lt;a href="http://en.wikipedia.org/wiki/Integrated_development_environment"&gt;IDE&lt;/a&gt;. It doesn't have any means for code editing. You will have to use an external text editor like notepad for creating .java files. &lt;br&gt;&lt;br /&gt;We can classify the main window into three parts:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Menu Bar&lt;br /&gt;&lt;li&gt;Tool Bar&lt;br /&gt;&lt;li&gt;Console Area&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;This have been marked in the figure:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-screen_markings.JPG"&gt;&lt;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="" /&gt;&lt;/a&gt;&lt;br /&gt;How to use WTK will be discussed as we begin coding.&lt;br /&gt;&lt;table width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td align="left"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-installation.html"&gt;Previous:Installation&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td align="center"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-table-of.html"&gt;Table of Contents&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td align="right"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-java-me.html"&gt;Next:Java ME Basics&lt;/a&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-8383107924508677394?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mZrA7y-ynXBukRSk6yuviFQTaDA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mZrA7y-ynXBukRSk6yuviFQTaDA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mZrA7y-ynXBukRSk6yuviFQTaDA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mZrA7y-ynXBukRSk6yuviFQTaDA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=VFiM6qVS"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=tqIJnIs5"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=ezsF0ktw"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=ezsF0ktw" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=sE0WKN3B"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=ybyQ0is6"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=MkivSa4m"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=MkivSa4m" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=s6Y8nJ40"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/MdlIcfiTVWc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/8383107924508677394/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=8383107924508677394" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/8383107924508677394?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/8383107924508677394?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/MdlIcfiTVWc/java-me-beginners-tutorial-wtk.html" title="Java ME Beginners Tutorial : WTK Explained" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.javameblog.com/2007/08/java-me-beginners-tutorial-wtk.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4ERH47fip7ImA9WB5bE0U.&quot;"><id>tag:blogger.com,1999:blog-5209778108692585660.post-6530724392118383537</id><published>2007-08-24T09:12:00.000+05:30</published><updated>2007-08-29T16:58:25.006+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-29T16:58:25.006+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WTK" /><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="Beginners" /><category scheme="http://www.blogger.com/atom/ns#" term="Installation" /><title>Java ME Beginners Tutorial : Installation Instructions</title><content type="html">&lt;span class="dropcaps"&gt;T&lt;/span&gt;&lt;br /&gt;his is the second part of the "Java ME Beginners Tutorial" series. If you haven't read the first part you can get it &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;here&lt;/a&gt; &lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;(Java ME Beginners Tutorial : Introduction)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This section explains about installing Sun's Wireless Tool kit (here forth called WTK) in your computer. Prior to installing WTK , you should have Java SE Development Kit installed.&lt;br /&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;If you have been programming in Java for a while, you may already have it. Otherwise &lt;a href="http://java.sun.com/javase/downloads/index.jsp"&gt;download JDK&lt;/a&gt; and install it first.&lt;br /&gt;&lt;br /&gt;The next step is the installation of the WTK itself. Download 'WTK for CLDC' &lt;a href="http://java.sun.com/products/sjwtoolkit/download.html"&gt;from the sun's site&lt;/a&gt;. As you will notice it is available for both Windows and Linux. This tutorial will be using WTK on Windows, but it will be much similar to use in a Linux machine.&lt;br /&gt;Once you install WTK you will get a menu entry in your start menu as shown.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-menu.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://anoopengineer.googlepages.com/wtk-menu.JPG" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The one which we are interested is Start Menu -&gt; All Programs -&gt; Sun Java(TM) Wireless Toolkit 2.5 for CLDC -&gt; Wireless Toolkit 2.5. (In older versions of WTK, the menu entry was named 'ktoolbar'). If you select it the following screen will be displayed.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://anoopengineer.googlepages.com/wtk-screen.JPG"&gt;&lt;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="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The next section will explain the WTK interface in detail.&lt;br /&gt;&lt;table width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt; &lt;td align="left"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-introduction.html"&gt;Previous:Introduction&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td align="center"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-table-of.html"&gt;Table of Contents&lt;/a&gt;&lt;/td&gt;&lt;br /&gt; &lt;td align="right"&gt;&lt;a href="http://javameblog.blogspot.com/2007/08/java-me-beginners-tutorial-wtk.html"&gt;Next:WTK Explained&lt;/a&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5209778108692585660-6530724392118383537?l=www.javameblog.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1-bxbD9X-Syqlt9T6PRNeMxjUD4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1-bxbD9X-Syqlt9T6PRNeMxjUD4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1-bxbD9X-Syqlt9T6PRNeMxjUD4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1-bxbD9X-Syqlt9T6PRNeMxjUD4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=RXdgAd48"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=pDr0A8Fb"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=50" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=6WIvPtrP"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=6WIvPtrP" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=A2DMdmbc"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=1LkLXVgc"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=54" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=IdyPakL1"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?i=IdyPakL1" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/JavaMeBlog?a=b8axcBep"&gt;&lt;img src="http://feeds.feedburner.com/~f/JavaMeBlog?d=129" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JavaMeBlog/~4/U4F0H6LDfW0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.javameblog.com/feeds/6530724392118383537/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=5209778108692585660&amp;postID=6530724392118383537" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/6530724392118383537?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5209778108692585660/posts/default/6530724392118383537?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaMeBlog/~3/U4F0H6LDfW0/java-me-beginners-tutorial-installation.html" title="Java ME Beginners Tutorial : Installation Instructions" /><author><name>Anoop Engineer</name><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03305639529739384718" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://www.javameblog.com/2007/08/java-me-beginners-tutorial-installation.html</feedburner:origLink></entry></feed>
