<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7397206376271418817</id><updated>2024-10-06T21:16:42.940-07:00</updated><category term="Frame Work"/><category term="HTML"/><category term="JAVA"/><category term="JSP"/><category term="Java Script"/><category term="Java XPath"/><category term="Object"/><category term="Programming"/><category term="Servlet"/><title type='text'>JAVA APPLICATION</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>91</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-2732120272206792887</id><published>2011-05-08T21:26:00.000-07:00</published><updated>2011-05-08T21:26:27.801-07:00</updated><title type='text'>Java Decompiler and its Missing Documentation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;color: black; font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; line-height: 19px; text-align: left;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;If you ever need a good decompiler for Java, there are&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://www.google.com/search?q=java+decompiler&amp;amp;ie=utf-8&amp;amp;oe=utf-8&amp;amp;aq=t&amp;amp;rls=org.mozilla:en-US:official&amp;amp;client=firefox-a&quot; style=&quot;border-bottom: 1px dashed rgb(168, 239, 157); border-width: 0px 0px 1px; margin: 0px; padding: 0px; text-decoration: none; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot; target=&quot;_blank&quot; title=&quot;Google search for &amp;quot;java decompiler&amp;quot;.&quot;&gt;plenty around&lt;/a&gt;. Nonetheless, I found one that integrates smoothly with Eclipse, which I’m guessing is not as common. The aptly named&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://java.decompiler.free.fr/&quot; style=&quot;border-bottom: 1px dashed rgb(168, 239, 157); border-width: 0px 0px 1px; margin: 0px; padding: 0px; text-decoration: none; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot; target=&quot;_blank&quot; title=&quot;Java Decompiler home page.&quot;&gt;Java Decompiler&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;is a newer one that has three parts: a core library (JD-Core), a GUI (JD-GUI) and an Eclipse plugin (JD-Eclipse). The purpose of the first two parts is fairly obvious. There is a core library that implements the decompiler and a GUI application you can use to view decompiled files. The Eclipse plugin is the most novel and interesting piece of the trio, so that’s what I’m going to discuss here.&lt;/div&gt;&lt;h1 style=&quot;border-width: 0px; font-size: 1.5em; margin: 0px; padding: 0.8em 0px; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;It sounds like a great plugin, but what does it do?&lt;/h1&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;That’s a good question, and it’s the natural one to ask when you’re looking for such a thing. The&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://java.decompiler.free.fr/?q=jdeclipse&quot; style=&quot;border-bottom: 1px dashed rgb(168, 239, 157); border-width: 0px 0px 1px; margin: 0px; padding: 0px; text-decoration: none; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot; target=&quot;_blank&quot; title=&quot;JD-Eclipse installation instructions.&quot;&gt;JD-Eclipse page&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;makes an effort to help you through installing the promising plugin, but it tells no stories about what functionality it offers. Oddly enough, the page doesn’t even explain what settings are available for the plugin. In fact, it doesn’t even mention that there are any preferences (yet they do exist).&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;It turns out that JD-Eclipse is quite a nice plugin. It quietly and effectively handles many use cases. There are some quirks with it, but overall it’s a great tool to have around. The official JD-Eclipse website lacks documentation on what to expect when using the tool. To fill that void, here are some of the features of JD-Eclipse that I’ve stumbled upon so far.&lt;/div&gt;&lt;h2 style=&quot;border-width: 0px; font-size: 1.4em; margin: 0px; padding: 0.8em 0px; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;Settings&lt;/h2&gt;&lt;div class=&quot;wp-caption alignleft&quot; id=&quot;attachment_264&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://s2.wp.com/wp-content/themes/pub/motion/images/blacktrans.png); background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 4px 4px; border-bottom-right-radius: 4px 4px; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-left-radius: 4px 4px; border-top-right-radius: 4px 4px; border-top-width: 0px; float: left; margin-bottom: 7px; margin-left: 0px; margin-right: 15px; margin-top: 5px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 6px; text-align: center; vertical-align: baseline; width: 310px;&quot;&gt;&lt;a href=&quot;http://thewonggei.files.wordpress.com/2011/04/jdeclipse-settings.jpg&quot; style=&quot;border-bottom: 1px dashed rgb(168, 239, 157); border-width: 0px 0px 1px; margin: 0px; padding: 0px; text-decoration: none; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;size-medium wp-image-264&quot; height=&quot;295&quot; src=&quot;http://thewonggei.files.wordpress.com/2011/04/jdeclipse-settings.jpg?w=300&amp;amp;h=295&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-style: initial; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot; title=&quot;jdeclipse-settings&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption-text&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 11px; line-height: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 4px; padding-right: 4px; padding-top: 0px; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;The JD-Eclipse settings panel.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-align: left; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;The plugin’s two settings are located in&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Window –&amp;gt; Preferences –&amp;gt; Java –&amp;gt; Decompiler&lt;/i&gt;. The&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Display line numbers&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;setting is deceitfully obvious. The “line numbers” referred to actually appear to be the line numbers from the .class file. The .class file line numbers are placed to the left of the code in a column of comments. In Listing 1, notice that the first number is the line number in the decompiled source file. Toggling off the&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Display line numbers&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;setting will remove the .class file line numbers.&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;86&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;setTitle(String title)&lt;br /&gt;
&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;87&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;88&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;/* 126 */&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;title&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;= title;&lt;br /&gt;
&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;89&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://s2.wp.com/wp-content/themes/pub/motion/images/blacktrans.png); background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 1.2em; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; overflow-x: auto; overflow-y: auto; padding-bottom: 1em; padding-left: 1.5em; padding-right: 1.5em; padding-top: 1em; vertical-align: baseline; white-space: pre-wrap; width: 600px;&quot;&gt;Listing 1 - A snippet of decompiled source code.&lt;/pre&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;The&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Display metadata&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;setting is useful to keep on. This prompts JD-Eclipse to add a comment to the bottom of each decompiled file identifying precisely which .class file was decompiled, what version of Java was used, and what version of JD-Core was used. The comment will look similar to Listing 2.&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;/* Location:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\eclipse-workspace\library.jar&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;&amp;nbsp; * Qualified Name:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; com.example.SampleClass&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;&amp;nbsp; * Java Class Version: 6 (50.0)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;&amp;nbsp; * JD-Core Version:&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.5.3&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;&amp;nbsp; */&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://s2.wp.com/wp-content/themes/pub/motion/images/blacktrans.png); background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 1.2em; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; overflow-x: auto; overflow-y: auto; padding-bottom: 1em; padding-left: 1.5em; padding-right: 1.5em; padding-top: 1em; vertical-align: baseline; white-space: pre-wrap; width: 600px;&quot;&gt;Listing 2 - The JD-Eclipse metadata from the bottom of a decompiled source file.&lt;/pre&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;One&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border-width: 0px; margin: 0px; padding: 0px; text-decoration: underline; vertical-align: baseline;&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;caveat to understand with these settings is that they are not instantly applied. Unlike all other Eclipse preferences, you have to restart Eclipse for these to take effect. I recommend just turning both on and leaving them set, which is the default.&lt;/div&gt;&lt;h2 style=&quot;border-width: 0px; font-size: 1.4em; margin: 0px; padding: 0.8em 0px; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;When and where does JD-Eclipse do its work for you?&lt;/h2&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;This is the real question I wanted an answer to before I installed it. Here are the scenarios I’ve encountered so far where JD-Eclipse decompiles code&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;automatically&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;for you. I emphasize automatic because that is why JD-Eclipse is a great tool. The designer has done a good job of figuring out when you would need code decompiled and has incorporated that knowledge into the plugin.&lt;/div&gt;&lt;h3 style=&quot;border-width: 0px; font-size: 1.3em; margin: 0px; padding: 0.8em 0px; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;Opening a Java type&lt;/h3&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;The most common scenario is when you’re opening a Java type. Specifically, a type for which the source code is absent from the project. There are several ways to do this in Eclipse and they all result in the decompiled source being opened.&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;As an example, let’s use the JDK classes. Especially if you’re using a licensed JDK like IBM’s, you probably don’t have the source code available in your workspace. But what if you want to look at a method’s implementation in the String class? You certainly do have the compiled JDK code in your workspace and JD-Eclipse can find it and decompile the class automatically. Here is a list of the ways I know of where you could open the String class in Eclipse:&lt;/div&gt;&lt;ol style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.5em; padding-left: 2em; padding-right: 0px; padding-top: 0.4em; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: decimal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;Use the&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Open Type&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;dialog (Ctrl+Shift+T)&lt;/li&gt;
&lt;li style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: decimal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;Use the&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Enterprise&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Explorer&lt;/i&gt;,&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Package Explorer&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;or&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Navigator&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;view to drill-down to and open the String class in the included JRE/JDK library.&lt;/li&gt;
&lt;li style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: decimal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;Hover over the text of the class name “String” in a source file and left-click to open the class.&lt;/li&gt;
&lt;li style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; list-style-image: initial; list-style-position: initial; list-style-type: decimal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;Open the String class from the result of a Java search.&lt;/li&gt;
&lt;/ol&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;I’m sure there are other ways to open a class in Eclipse, but this list covers the most common scenarios. In any case, the result is that you can see the source code for the String class, a feat that JD-Eclipse pulls off automatically and silently. The only way you even know that JD-Eclipse was involved is by the display of its signature coffee mug icon beside the class name.&lt;/div&gt;&lt;div class=&quot;wp-caption aligncenter&quot; id=&quot;attachment_262&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://s2.wp.com/wp-content/themes/pub/motion/images/blacktrans.png); background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 4px 4px; border-bottom-right-radius: 4px 4px; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-left-radius: 4px 4px; border-top-right-radius: 4px 4px; border-top-width: 0px; display: block; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 6px; text-align: center; vertical-align: baseline; width: 650px;&quot;&gt;&lt;a href=&quot;http://thewonggei.files.wordpress.com/2011/04/jdeclipse-string.jpg&quot; style=&quot;border-bottom: 1px dashed rgb(168, 239, 157); border-width: 0px 0px 1px; margin: 0px; padding: 0px; text-decoration: none; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;size-full wp-image-262&quot; height=&quot;469&quot; src=&quot;http://thewonggei.files.wordpress.com/2011/04/jdeclipse-string.jpg?w=640&amp;amp;h=469&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-style: initial; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot; title=&quot;jdeclipse-string&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption-text&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 11px; line-height: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 4px; padding-right: 4px; padding-top: 0px; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;The decompiled java.lang.String class in Eclipse with the JD-Eclipse coffee mug logo.&lt;/div&gt;&lt;/div&gt;&lt;h3 style=&quot;border-width: 0px; font-size: 1.3em; margin: 0px; padding: 0.8em 0px; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;Debugging&lt;/h3&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;This scenario was the most surprising to me. I expected that when I opened a class with no source code that I would get the decompiled source, but I assumed that’s where JD-Eclipse would stop. Pleasingly, the decompiler also works when debugging. The simple act of stepping into code with no source code present will cause JD-Eclipse to kick in. The debugger will happily then display the decompiled source code and break at the expected line.&amp;nbsp; Impressive.&lt;/div&gt;&lt;div class=&quot;wp-caption aligncenter&quot; id=&quot;attachment_263&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://s2.wp.com/wp-content/themes/pub/motion/images/blacktrans.png); background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 4px 4px; border-bottom-right-radius: 4px 4px; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-left-radius: 4px 4px; border-top-right-radius: 4px 4px; border-top-width: 0px; display: block; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 6px; text-align: center; vertical-align: baseline; width: 650px;&quot;&gt;&lt;a href=&quot;http://thewonggei.files.wordpress.com/2011/04/jdeclipse-debugging.jpg&quot; style=&quot;border-bottom: 1px dashed rgb(168, 239, 157); border-width: 0px 0px 1px; margin: 0px; padding: 0px; text-decoration: none; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;size-full wp-image-263&quot; height=&quot;346&quot; src=&quot;http://thewonggei.files.wordpress.com/2011/04/jdeclipse-debugging.jpg?w=640&amp;amp;h=346&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-style: initial; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot; title=&quot;jdeclipse-debugging&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption-text&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 11px; line-height: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 4px; padding-right: 4px; padding-top: 0px; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;The &quot;debug&quot; perspective in Eclipse. The debugger is at a break point in the String class.&lt;/div&gt;&lt;/div&gt;&lt;h2 style=&quot;border-width: 0px; font-size: 1.4em; margin: 0px; padding: 0.8em 0px; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;When does JD-Eclipse not work for you?&lt;/h2&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;There are some times when JD-Eclipse doesn’t do what I hoped it would. The biggest short-coming I’ve seen so far is that the decompiled code doesn’t always work correctly with the debugger. I’ve had a few times where the debugger breaks at a non-sensical line such as a closing bracket. Why this is, I can’t say for sure. My guess is that the process of compiling and decompiling causes the line numbers to be off slightly. This may not even be the fault of JD-Eclipse, but it’s still a nuisance.&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;JD-Eclipse also appears to override Eclipse when you actually have source code attached to a library. Even when you’ve configured your project to reference source code for a library, JD-Eclipse always wins out and displays the decompiled code. Ideally, JD-Eclipse should recognize this setting and let the real source code open rather than intervening with its decompiled version.&lt;/div&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;The other scenario that JD-Eclipse doesn’t cover is JSP files. Unfortunately, I haven’t yet found a way to decompile a compiled JSP. Again, this may be more an issue with Eclipse than JD-Eclipse.&lt;/div&gt;&lt;h1 style=&quot;border-width: 0px; font-size: 1.5em; margin: 0px; padding: 0.8em 0px; text-shadow: 0px 0px 4px rgb(68, 68, 68); vertical-align: baseline;&quot;&gt;Conclusion&lt;/h1&gt;&lt;div style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0.2em; padding-left: 0px; padding-right: 0px; padding-top: 0.6em; text-shadow: rgb(68, 68, 68) 0px 0px 4px; vertical-align: baseline;&quot;&gt;JD-Eclipse is a great tool to have if you work often in Eclipse. What struck me as most enticing about it is how nimbly and stealthy it does its job. Most times, it just does what you want it to do, which is show the source code. Oh, and I didn’t mention that it’s fast. I’ve never noticed a pause while JD-Eclipse is decompiling. The source just opens as if it were right there in my project.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/2732120272206792887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/2732120272206792887' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/2732120272206792887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/2732120272206792887'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/java-decompiler-and-its-missing.html' title='Java Decompiler and its Missing Documentation'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-6376999630450724763</id><published>2011-05-08T21:24:00.000-07:00</published><updated>2011-05-08T21:24:59.114-07:00</updated><title type='text'>Decompile java code with Cavaj</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;trebuchet ms&#39;, Verdana, Tahoma, Arial; font-size: 11px; letter-spacing: 1px; line-height: 15px; text-align: justify;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;display: block; font-family: Arial; font-size: 14px; list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot;&gt;&lt;a href=&quot;http://www.digitalprank.org/decompile-java-code-with-cavaj/&quot; rel=&quot;bookmark&quot; style=&quot;color: #00478c; font: normal normal bold 22px/28px &#39;Myriad Pro&#39;, &#39;Myriad Set&#39;, &#39;Myriad Apple&#39;, Myriad, &#39;Helvetica Nueue&#39;, Arial, Verdana, sans-serif; list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot; title=&quot;Permanent Link: Decompile java code with Cavaj&quot;&gt;Decompile java code with Cavaj&lt;/a&gt;&lt;/h2&gt;&lt;div class=&quot;KonaBody&quot; style=&quot;list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivKf-jMLoOlFUIf0DMhXbje9lZjqemn1jihDC2TYPxKcQpUJ4ds7CMNJR3YBzTeF8apMn64E_sYzhpwu20I5FtU7fOdNaqENv90goRHeTI1jeZlWDFLoXoUIRT3IOukQB9Xlsdi-hFtZY/s1600/java.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot; style=&quot;line-height: 1.5; list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 1.5em; padding-bottom: 10px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot;&gt;&lt;img align=&quot;left&quot; alt=&quot;Cavaj decompiler&quot; border=&quot;0&quot; height=&quot;115&quot; src=&quot;http://www.digitalprank.org/wp-content/uploads/2009/02/cavajdecompiler.png&quot; style=&quot;border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-color: initial; border-left-color: initial; border-left-style: initial; border-left-width: 0px; border-right-color: initial; border-right-style: initial; border-right-width: 0px; border-top-color: initial; border-top-style: initial; border-top-width: 0px; border-width: initial; display: inline; list-style-image: initial; list-style-position: initial; list-style-type: none; margin-bottom: 10px; margin-left: 0px; margin-right: 10px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot; title=&quot;Cavaj decompiler&quot; width=&quot;240&quot; /&gt;Decompilers are used commonly for reconstructing the lost code and is used across different programming languages and in all platforms.The use of decompilers in java programming language is quite high compared to other ones. I have written an article about Java Decompilers last year which talks about the best open-source and commercial decompilers. I missed an important freeware java decompiler called Cavaj which helps you decompile java source code from class files recovering the lost source code.&lt;/div&gt;&lt;div align=&quot;justify&quot; style=&quot;line-height: 1.5; list-style-type: none; margin: 1.5em 0px 0px; padding: 0px 0px 10px; text-decoration: none;&quot;&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot; style=&quot;line-height: 1.5; list-style-type: none; margin: 1.5em 0px 0px; padding: 0px 0px 10px; text-decoration: none;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;trebuchet ms&#39;, Verdana, Tahoma, Arial; font-size: 11px; letter-spacing: 1px; line-height: 15px; text-align: justify;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivKf-jMLoOlFUIf0DMhXbje9lZjqemn1jihDC2TYPxKcQpUJ4ds7CMNJR3YBzTeF8apMn64E_sYzhpwu20I5FtU7fOdNaqENv90goRHeTI1jeZlWDFLoXoUIRT3IOukQB9Xlsdi-hFtZY/s1600/java.bmp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;528&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivKf-jMLoOlFUIf0DMhXbje9lZjqemn1jihDC2TYPxKcQpUJ4ds7CMNJR3YBzTeF8apMn64E_sYzhpwu20I5FtU7fOdNaqENv90goRHeTI1jeZlWDFLoXoUIRT3IOukQB9Xlsdi-hFtZY/s640/java.bmp&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Cavaj reconstructs the source code with the Class View providing instant access to methods and fields in the form of a tree view. The good thing about Cavaj Java Decompiler is, it doesn’t require you to have Java installed to use the decompiler and it is just a light weight stand-alone application. Cavaj Java decompiler uses Jad as its Java decompiling engine which makes the application light weight and handy. Check it out guyz.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/6376999630450724763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/6376999630450724763' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/6376999630450724763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/6376999630450724763'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/decompile-java-code-with-cavaj.html' title='Decompile java code with Cavaj'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivKf-jMLoOlFUIf0DMhXbje9lZjqemn1jihDC2TYPxKcQpUJ4ds7CMNJR3YBzTeF8apMn64E_sYzhpwu20I5FtU7fOdNaqENv90goRHeTI1jeZlWDFLoXoUIRT3IOukQB9Xlsdi-hFtZY/s72-c/java.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-7514368761369491002</id><published>2011-05-08T21:20:00.001-07:00</published><updated>2011-05-08T21:20:18.393-07:00</updated><title type='text'>How To Extract Fla Files From Flash Files With Swf Decompiler</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;What is a decompiler? Some people may ask. Well, decompiling is a common technique used to reverse engineer compiled files (.swf files), in order to retrieve a representation of the original code. Flash decompiling has been around since the first decompiler (Action Script Viewer) was released in May 2000. At present, there are several tools on the market, such as Eltima Decompiler Trillix, ASV and Flare.Discretion should be used though because as with everything, it can be used for less honorable purposes ( i.e. plagiarizing assets and code). For this reason, the issue of decompiling is a contentious one.&lt;br /&gt;
&lt;br /&gt;
To its defence, a decompiler can have many benefits. It can be a good way to sneak a peek at other peoples code and learn new techniques. Also, if youve lost an .fla and only have the swf at hand, its a good way to recover code, from which you can reconstruct the piece of original work. Phew, what a relief!&lt;br /&gt;
&lt;br /&gt;
Then we should also learn something about the difference between SWF files and FLA files.&lt;br /&gt;
&lt;br /&gt;
First of all, the SWF file is more like a large collection of FLA files. The SWF is a package that contains FLA file and any other files or content you used when making a flash project (Action Script codes, images, text, sounds, etc). If it is to compare SWF with another popular extension, you could say that the SWF it is like the EXE file. So, when we talk about FLA we talk about the core structure of a SWF file (the exact same thing as for Adobe Photoshop and its PSD files).&lt;br /&gt;
&lt;br /&gt;
Now, extracting FLA from SWF is not as simple as it sounds and without a powerful tool it would be almost impossible. A poorly designed application can extract damaged FLA files, files which are absolutely impossible to use for a different purpose.&lt;br /&gt;
&lt;br /&gt;
Recently I had come across SWF Decompiler/ SWF Decompiler for Mac. And after testing, I found that I was not wrong to expect a lot from this SWF Decompiler/ SWF Decompiler for Mac as the software itself provides plenty of features, tools and options. It&#39;s absolutely incredible as for how easy it is to convert a Flash video to FLA files.&lt;br /&gt;
&lt;br /&gt;
This SWF Decompiler/ SWF Decompiler for Mac is fast, reliable and really important, affordable. Usually, similar applications are extremely expensive and a simple home user cannot afford them. Because of that, common users have to buy random SWF Decompiler/ SWF Decompiler for Mac (cheaper but also poorly designed). However, the time for random decompiler is over. This SWF Decompiler/ SWF Decompiler for Mac can solve all these problems for you in a simple and professional way.&lt;br /&gt;
&lt;br /&gt;
So, I would like to strongly recommend this SWF Decompiler/ SWF Decompiler for Mac for those who need to convert and decompile SWF files.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/7514368761369491002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/7514368761369491002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/7514368761369491002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/7514368761369491002'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/how-to-extract-fla-files-from-flash.html' title='How To Extract Fla Files From Flash Files With Swf Decompiler'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-6476900300837126903</id><published>2011-05-08T21:19:00.000-07:00</published><updated>2011-05-08T21:19:49.810-07:00</updated><title type='text'>Learn how to download applets and decompile Java class files</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Update&lt;br /&gt;
This article is a little old now, so I&#39;ve started a new series (as of April, 2010) on Java decompilers and obfuscators. Please follow that link for much more recent information. The content below is kept here only for legacy reasons.&lt;br /&gt;
&lt;br /&gt;
Introduction&lt;br /&gt;
In our previous article, we demonstrated a simple method that can be used to easily download the class files of Java applets. In this article we&#39;ll show you how to decompile the Java class, turning the .class file back into a .java source code file.&lt;br /&gt;
&lt;br /&gt;
Why do this?&lt;br /&gt;
If you&#39;re just joining us in Part 2 of our series, I feel the need to explain why we&#39;re doing this series in the first place:&lt;br /&gt;
&lt;br /&gt;
First, we&#39;re a Java educational center. Telling you the bad about Java as well as the good is also educational. Whether it&#39;s bad or good, it is truth. The fact is that other people can decompile your Java classes, and you need to know that, and it&#39;s helpful to know how they can do it.&lt;br /&gt;
Second, and even more importantly, if you know how to decompile Java classes, you can also learn how to try stop it (assuming you&#39;re interested in stopping it).&lt;br /&gt;
&lt;br /&gt;
Obtaining software to decompile Java class files&lt;br /&gt;
To decompile a Java class file, you&#39;re going to need some software specially made for decompiling Java class files (also called reverse-engineering). In this article we&#39;re going to show you how to decompile Java class files with a software package that goes by the name of Mocha.&lt;br /&gt;
&lt;br /&gt;
Mocha is probably not the best decompiling software available today, but it is one of the first packages available - if not the first - and it&#39;s also free. Mocha is written in Java, so you&#39;ll also need a copy of the Java JDK, or the JRE.&lt;br /&gt;
&lt;br /&gt;
Step 1: Download Mocha&lt;br /&gt;
Assuming that you already have a copy of the Java JDK, the first step in the decompilation process is to download Mocha. Click here to download Mocha.&lt;br /&gt;
&lt;br /&gt;
Step 2: Install Mocha&lt;br /&gt;
After you&#39;ve downloaded Mocha, install it in a directory according to the installation instructions that came with the Mocha software. At the time of this writing, the installation process simply consists of unpacking a ZIP file into a desired directory.&lt;br /&gt;
&lt;br /&gt;
Decompiling a Java class file&lt;br /&gt;
In this article we&#39;re going to decompile the AnimatedAd.class Java class file we downloaded in Part 1 of this article. If you&#39;re at all familiar with our web site, you might know that the original source code for this class file is also available. This is good, because it gives us a chance to compare the original source code to the decompiled version of the source code.&lt;br /&gt;
&lt;br /&gt;
If you&#39;re ready, let&#39;s begin the process of decompiling the class file. If you&#39;ve installed Mocha properly, there&#39;s really very little to the process other than running Mocha.&lt;br /&gt;
&lt;br /&gt;
Step 1: Open a DOS or Unix window&lt;br /&gt;
Running Mocha is very simple. Assuming you&#39;re using a Windows system, just open a DOS window, and move to the directory where you installed Mocha.&lt;br /&gt;
&lt;br /&gt;
If you&#39;re using a version of Unix, open a Unix command-line window and move to the Mocha installation directory.&lt;br /&gt;
&lt;br /&gt;
Step 2: Modify your CLASSPATH variable&lt;br /&gt;
In this step, modify your CLASSPATH environment variable to include the Mocha.zip file you just downloaded and installed.&lt;br /&gt;
&lt;br /&gt;
For instance, using Visual Cafe 2.5 on a Windows95 computer system, I modified my CLASSPATH to look like this:&lt;br /&gt;
&lt;br /&gt;
set CLASSPATH=C:\Apps\Win95\Symantec\VisualCafe2.5\BIN\COMPONENTS\SYMBEANS.JAR;&lt;br /&gt;
C:\Apps\Win95\Symantec\VisualCafe2.5\JAVA\LIB\CLASSES.ZIP;&lt;br /&gt;
C:\Apps\Win95\Symantec\VisualCafe2.5\JAVA\LIB;&lt;br /&gt;
C:\Temp\DevDaily\Java\Decompilers\Mocha.zip&lt;br /&gt;
&lt;br /&gt;
This should all be one continuous line. (Actually, because my CLASSPATH is so long, I cheated and combined this step and the command from Step 4 into a DOS batch file named runmocha.bat.)&lt;br /&gt;
&lt;br /&gt;
Step 3: Copy the class file to the Mocha installation directory&lt;br /&gt;
If you haven&#39;t done so already, copy the AnimatedAd.class file into the Mocha installation directory.&lt;br /&gt;
&lt;br /&gt;
Step 4: Run the Mocha program&lt;br /&gt;
Once the CLASSPATH is set, you can run Mocha like this to decompile the AnimatedAd.class file:&lt;br /&gt;
&lt;br /&gt;
java -classpath %CLASSPATH% mocha.Decompiler -v AnimatedAd.class&lt;br /&gt;
Notice that I included the -v option (verbose) to see a little more output than normal. It&#39;s not required, but it is helpful.&lt;br /&gt;
&lt;br /&gt;
When Mocha runs, you&#39;ll see some output on your screen similar to Figure 1.&lt;br /&gt;
&lt;br /&gt;
Decompiling AnimatedAd.class -&amp;gt; AnimatedAd.mocha &lt;br /&gt;
&amp;nbsp;Method init.................................................................... &lt;br /&gt;
&amp;nbsp;................................................................................ &lt;br /&gt;
&amp;nbsp;................................................................................ &lt;br /&gt;
&amp;nbsp;................................................................................ &lt;br /&gt;
&amp;nbsp;................................................................................ &lt;br /&gt;
&amp;nbsp;........................ &lt;br /&gt;
&amp;nbsp;Method start................ &lt;br /&gt;
&amp;nbsp;Method stop.............. &lt;br /&gt;
&amp;nbsp;Method run..................................................................... &lt;br /&gt;
&amp;nbsp;......................................................................... &lt;br /&gt;
&amp;nbsp;Method mouseDown............... &lt;br /&gt;
&amp;nbsp;Method pause........ &lt;br /&gt;
&amp;nbsp;Method drawMyString.............. &lt;br /&gt;
&amp;nbsp;Method paint................ &lt;br /&gt;
&amp;nbsp;Method numStringsUsed......................... &lt;br /&gt;
&amp;nbsp;Method getRandomInt................................................. &lt;br /&gt;
&amp;nbsp;Method &amp;lt;init&amp;gt;............................. &lt;br /&gt;
&lt;br /&gt;
The decompiled source code&lt;br /&gt;
When Mocha runs, it also creates an output file named AnimatedAd.mocha. This file contains the decompiled Java source code - the source code it created by reading the AnimatedAd.class binary file.&lt;br /&gt;
&lt;br /&gt;
The AnimatedAd.mocha file is too large to list here, but you can click here to view the reverse-engineered source code.&lt;br /&gt;
&lt;br /&gt;
As a point of comparison, you can click here to view the original AnimatedAd.java source code.&lt;br /&gt;
&lt;br /&gt;
Summary&lt;br /&gt;
I hope you enjoyed this two-part series on downloading and decompiling Java applets. If you have any questions or comments, please leave them in the comments section below.&lt;br /&gt;
&lt;br /&gt;
(Editor&#39;s Note: The process of decompiling Java class files belonging to other businesses or individuals may be illegal in your city, state, or country. Frankly, I don&#39;t know for sure, because, to coin a phrase from Star Trek&#39;s (TM) Doctor McCoy, &quot;I&#39;m an editor, not a lawyer.&quot; In any case, this series of articles is not written to encourage that practice. These articles are presented only so you can learn to protect your own Java class files from reverse engineering.)&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/6476900300837126903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/6476900300837126903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/6476900300837126903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/6476900300837126903'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/learn-how-to-download-applets-and.html' title='Learn how to download applets and decompile Java class files'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-4939116163435615310</id><published>2011-05-08T21:18:00.000-07:00</published><updated>2011-05-08T21:18:07.568-07:00</updated><title type='text'>Protect Your Java Code from Reverse Engineering</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If you are developing java application, it is important to understand that the java class files can be easily reverse engineered using java decompilers. In this article, let us explore how a java class file is reverse engineered and how to protect your source code from being reverse engineered by someone.&lt;br /&gt;
&lt;br /&gt;
The java source code is compiled to a class file that contains byte code. Java Virtual Machine needs only the class file for execution. The problem is that the class file can easily be decompiled into the original source code using java decompiler tools. The best solution to prevent reverse engineering is to obfuscate the class file so that is will be very hard to reverse engineer. According to the dictionary Obfuscate means “to make obscure or unclear”. That is exactly what lot of java obfuscator tool will do as explained below.&lt;br /&gt;
&lt;br /&gt;
I. Decompile Java class file.&lt;br /&gt;
&lt;br /&gt;
Before understanding how to obfuscate the java code, let us first try to understand how someone can reverse engineer your java application. Following 3 steps explains how a class file is reverse engineered to the original java source code.&lt;br /&gt;
&lt;br /&gt;
1. Create HelloWorld.java as shown below.&lt;br /&gt;
&lt;br /&gt;
public class HelloWorld {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main (String args[]) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String userMessage = &quot;Hello World!&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int userCount = 100;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; userCount = userCount + 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(userMessage);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(userCount);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
2. Compile HelloWorld.java program and execute it to make sure it works properly.&lt;br /&gt;
&lt;br /&gt;
$ javac HelloWorld.java&lt;br /&gt;
$ java HelloWorld&lt;br /&gt;
Hello World!&lt;br /&gt;
101&lt;br /&gt;
Java class file contains only byte code. If you try to view a class file, it will be non-readable as shown below.&lt;br /&gt;
&lt;br /&gt;
$ vi HelloWorld.class&lt;br /&gt;
ÃÃ¾ÂºÂ¾^@^@^@2^@&lt;br /&gt;
^@^G^@^P^H^@^Q&amp;nbsp; ^@^R^@^S&lt;br /&gt;
^@^T^@^V^G^@^W^G^@^X^A^@^F&amp;lt;init&amp;gt;^A^@^C()V^A^@^DCode^A^@^OLineNumberTable&lt;br /&gt;
^A^@^Dmain^A^@^V([Ljava/lang/String;)V^A^@&lt;br /&gt;
SourceFile^A^@^OHelloWorld.java^L^@^H^@ ^A^@^LHello World!^G^@^Y^L^@^Z^@^[^G^@^\^L^@^]^@^^^L^@^]^@^_^A^@&lt;br /&gt;
HelloWorld^A^@^Pjava/lang/Object^A^@^Pjava/lang/System^A^@^Cout^A^@^ULjava/io/PrintStream;^A&lt;br /&gt;
^@^Sjava/io/PrintStream^A^@^Gprintln^A^@^U(Ljava/lang/String;)V^A^@^D(I)V^@!^@^F^@^G^@^@^@^@^@^B^@^A^@^H^@&amp;nbsp; ^@^A^@&lt;br /&gt;
&lt;br /&gt;
3. Decompile HelloWorld.class file and view the original source.&lt;br /&gt;
&lt;br /&gt;
For this demonstration let us use Jad decompiler which is free for non-commercial use. Download the appropriate jad for your platform. Use jad to reverse engineer the HelloWorld.class file to get the original source as shown below.&lt;br /&gt;
&lt;br /&gt;
$ unzip jadls158.zip&lt;br /&gt;
$ ./jad HelloWorld.class&lt;br /&gt;
Parsing HelloWorld.class...&lt;br /&gt;
Generating HelloWorld.jad&lt;br /&gt;
$ vi HelloWorld.jad &amp;lt;This will show the reverse engineered original source code&amp;gt;&lt;br /&gt;
II. Obfuscate your java application&lt;br /&gt;
&lt;br /&gt;
Let us review how to obfuscate and protect your source code from reverse engineering using ProGuard a free GPL licensed software.&lt;br /&gt;
&lt;br /&gt;
1. Download and Install ProGuard&lt;br /&gt;
&lt;br /&gt;
$ cd /home/jsmith&lt;br /&gt;
$ unzip proguard4.2.zip&lt;br /&gt;
2. Create a proguard config file&lt;br /&gt;
&lt;br /&gt;
Create myconfig.pro that contains all the information about your java application.&lt;br /&gt;
&lt;br /&gt;
-injar : Specify the location of your jar file. i.e the compiled java application that contains the class files&lt;br /&gt;
-outjar: This is the jar file proguard will create after obfuscation. This will contain all the mangled, obscure naming convention of the methods and variables in the class file if someone tries to reverse engineer.&lt;br /&gt;
-printmapping: ProGurad outputs all the mapping information in this file for your reference.&lt;br /&gt;
-keep: Indicate the class files or the methods that you don’t want ProGuard to obfuscate. For e.g. mypkg.MainAppFrame contains the entry point for the application with the main class, which will not get obfuscated in this example.&lt;br /&gt;
$ cat myconfig.pro&lt;br /&gt;
-injars /home/jsmith/myapp.jar&lt;br /&gt;
-outjars /home/jsmith/myapp-obfuscated.jar This is the obfuscated jar file&lt;br /&gt;
-libraryjars /usr/java/jdk1.5.0_14/jre/lib/rt.jar&lt;br /&gt;
-printmapping proguard.map&lt;br /&gt;
-verbose&lt;br /&gt;
-keep public class mypkg.MainAppFrame&lt;br /&gt;
3. Execute ProGuard.&lt;br /&gt;
&lt;br /&gt;
$ cd /home/jsmith/proguard4.2/lib&lt;br /&gt;
$ java -jar proguard.jar @myconfig.pro&lt;br /&gt;
This creates the following two files:&lt;br /&gt;
&lt;br /&gt;
myapp-obfuscated.jar: Contains the obfuscated class files of your application. You can distribute this without having to worry about someone reverse engineering your application easily.&lt;br /&gt;
proguard.map: This file contains the mapping information for your reference.&lt;br /&gt;
4. Sample proguard.map file&lt;br /&gt;
&lt;br /&gt;
This is a sample proguard.map file that indicates the original name of the java source objects (classfile, methods, variable etc.) and the new obfuscated name.&lt;br /&gt;
&lt;br /&gt;
myapp.AppToolBar -&amp;gt; myapp.ae:&lt;br /&gt;
javax.swing.JButton btnNew -&amp;gt; d&lt;br /&gt;
javax.swing.JButton btnOpen -&amp;gt; e&lt;br /&gt;
5. Sample java source code (myapp.AppToolBar) before obfuscation.&lt;br /&gt;
&lt;br /&gt;
btnNew = changeButtonLabel(btnNew, language.getText(&quot;new&quot;));&lt;br /&gt;
btnOpen = changeButtonLabel(btnOpen, language.getText(&quot;open&quot;));&lt;br /&gt;
6. Sample java source code that was decompiled from the class file (myapp.ae) after obfuscation.&lt;br /&gt;
&lt;br /&gt;
d = a(d, n.a(&quot;new&quot;));&lt;br /&gt;
e = a(e, n.a(&quot;open&quot;));&lt;br /&gt;
You can see that the line “btnNew = changeButtonLabel(btnNew, language.getText(“new”));” got translated to “d = a(d, n.a(“new”));”, by the ProGuard, which will not make any sense to someone who is using java decompiler tools to reverse engineer the class file.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/4939116163435615310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/4939116163435615310' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/4939116163435615310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/4939116163435615310'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/protect-your-java-code-from-reverse.html' title='Protect Your Java Code from Reverse Engineering'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-7473033188246372590</id><published>2011-05-08T21:16:00.000-07:00</published><updated>2011-05-08T21:16:10.321-07:00</updated><title type='text'>Java Decompilers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp;This article isn&#39;t anwhere near current but is still valid as general commentary on java decompilers.&amp;nbsp; I&#39;m not planning to re-review the modern crop, but I will note new programs as I become aware of them.&lt;br /&gt;
&lt;br /&gt;
and are they worth worrying about&lt;br /&gt;
&lt;br /&gt;
Generally, the object of decompiler is to accept a java .class file as input, and produce a compilable source file as its result. In the chaotic world of software development there are many reasons, legitimate and otherwise, to wish for such a tool. The transparent and information-rich structure of java .class files, which makes Java&#39;s dynamic linking so much better than previously common models, also makes such tools particularly easy to build.&lt;br /&gt;
What tools are available?&lt;br /&gt;
&lt;br /&gt;
All of these tools are pure java, so the essential distribution consists of a java class library and instructions to invoke it. They&#39;re all a littly quirky to set up and use, a characteristic shared by many standalone java applications. Once set up, they more or less &quot;just work&quot;, producing output that is nearly ready for the compiler.&lt;br /&gt;
Mocha is free. Unfortunately, its author is prematurely deceased, and its future as a product is in doubt.&lt;br /&gt;
WingDis, is a product of Wing Software. A &quot;crippleware&quot; demo is available. [April 2002, still available and supported]&lt;br /&gt;
DejaVu, is distributed as part of the OEW developement environment, but appears to be completely independant of it. OEW is available as a free trial, and DeJaVu continues to be functional when the trial has expired. I&#39;ve reviewed OEW separately.&lt;br /&gt;
[April 2002, Open source decompiler Jreverse Pro]&lt;br /&gt;
Testing method&lt;br /&gt;
&lt;br /&gt;
I chose a small utility library, consisting of about 15 classes, as my standard test set. I compiled the library using JDK 1.02, with -o and without -g. I decompiled with all three decompilers, then manually edited the decompiled sources until they could be successfully recompiled. I then decompiled these three sets of &quot;second generation&quot; binaries, with each of the three decompilers, yielding nine sets of &quot;third generation&quot; sources. I then manually compared various pairs of sources, looking for inconsistancies which might indicate incorrectly decompiled code. Since this was a &quot;only a test&quot;, I had the luxury of referring to the original sources, and the double luxury that I wrote these sources myself; two advantages that would not generally be available to anyone using a decompiler in earnest.&lt;br /&gt;
The test set was not specifically designed to validate or torture decompilers, and there is no way to know if the results here are representative of all classes, or if the list of problems encountered is complete. It should, however, give you some idea what to watch for.&lt;br /&gt;
&lt;br /&gt;
I organized decompilation errors according to the taxonomy below, based on the general idea that easy-to-spot and easy-to-fix errors were less significant than hidden or hard to fix errors. The very worst thing a decompiler can do is produce code that passes through a compiler without complaint, but which is not functionally equivalent to the original code.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;&lt;caption&gt;&lt;h2&gt;Error Taxonomy&lt;/h2&gt;&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 1 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 2 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 3 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 4 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 5 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 6 errors&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;i&gt;general description&lt;/i&gt;&lt;/td&gt;&lt;td&gt;flagged by compiler, easily fixed&lt;/td&gt;&lt;td&gt;flagged by compiler, not easily fixed.&lt;/td&gt;&lt;td&gt;Ugly, Incomprehinsible, but correct code.&lt;/td&gt;&lt;td&gt;Suble misprints. Subtly Incorrect programs&lt;/td&gt;&lt;td&gt;Total failure.&lt;/td&gt;&lt;td&gt;Gross errors Severly damaged semmantics No warning, and hard to identify&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;i&gt;example&lt;/i&gt;&lt;/td&gt;&lt;td&gt;boolean variable incorrectly identified as intmissing, but trivial type cast.&lt;/td&gt;&lt;td&gt;generating code containing&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;goto&lt;/b&gt;&lt;/td&gt;&lt;td&gt;unreconstructed flow conrolunreconstructed use of&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;+&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;for string append&lt;/td&gt;&lt;td&gt;failing to use \ to escape characters in string constantsmisprinting character constants&lt;/td&gt;&lt;td&gt;crash without producing output&lt;/td&gt;&lt;td&gt;misuse or non-use of &quot;this.&quot;other patently incorrect code&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;caption&gt;&lt;h2&gt;Decompiler Errors by type&lt;/h2&gt;&lt;/caption&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 1 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 2 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 3 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 4 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 5 errors&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Class 6 errors&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Mocha&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
version beta 1&lt;/td&gt;&lt;td&gt;a few&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;yes, mocha crashes on some class files.&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;WingDis&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
version 2.06&lt;/td&gt;&lt;td&gt;just one&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;overuse of if(x!=false) and similar construction&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;misuse or non-use of of &quot;super.&quot;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
mistranslation of x=a++; to a++; x=a;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;DeJaVu&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
version 1.0&lt;/td&gt;&lt;td&gt;a few&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;major problem with flow analysis&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;h2&gt;&lt;br /&gt;
&lt;/h2&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/7473033188246372590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/7473033188246372590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/7473033188246372590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/7473033188246372590'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/java-decompilers.html' title='Java Decompilers'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-8449853169630435799</id><published>2011-05-08T21:15:00.000-07:00</published><updated>2011-05-08T21:15:10.071-07:00</updated><title type='text'>CONTENTS  Introduction  Bytecode Encryption- Straightforward But Totally Flawed  Name Obfuscation  String Encryption  Code and Data Flow Obfuscation  Strengthening Protection with Ahead-Of-Time Compilation  Popular Obfuscators  Further Reading  Appendices:  Obfuscation Examples  Impact of Flow Obfuscation on Performance  Protect Your Java Code - Through Obfuscators And Beyond</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;Reverse engineering of your proprietary applications by unfair competition or malicious hackers may result in highly undesirable exposure of your algorithms and ideas, proprietary data formats, licensing and security mechanisms, and, most importantly, your customer&#39;s data. Here is why Java is particularly weak in this respect compared to C++:&lt;/div&gt;&lt;table class=&quot;boxed spacebelow&quot; style=&quot;border-bottom-color: rgb(34, 136, 136); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: separate; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; clear: both; font-size: 1em; margin-bottom: 1.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;50%&quot;&gt;&lt;/col&gt;&lt;col width=&quot;50%&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th colspan=&quot;2&quot; style=&quot;background-color: #228888; color: white; font-size: 1em; font-weight: bold; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot;&gt;Target Instruction Set&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;TOP&quot;&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;&lt;b&gt;C++:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;Compiles to a low-level instruction set that operates on raw binary data and is specific to the target hardware, such as x86 or PowerPC&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;&lt;b&gt;Java:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;Compiles to a higher-level portable bytecode that operates on classes and primitive types.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th colspan=&quot;2&quot; style=&quot;background-color: #228888; color: white; font-size: 1em; font-weight: bold; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot;&gt;Compiler Optimizations&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;&lt;b&gt;C++:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;Numerous code optimizations are performed at compile time. Inline substitution results in copies of the given (member) function being scattered around the binary image; use of the preprocessor combined with compile-time evaluation of expressions may leave no trace of the constants defined in the source code; and so on.&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;&lt;b&gt;Java:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;Relies on dynamic (Just-In-Time) compilation for performance improvement. The standard&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;tt style=&quot;font-family: &#39;Lucida Console&#39;, Courier;&quot;&gt;javac&lt;/tt&gt;compiler is straightforward, it does no compile time optimizations commonly found in C++ compilers. The idea is to enable the JIT compiler to perform all optimizations at run time, taking the execution profile into account.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th colspan=&quot;2&quot; style=&quot;background-color: #228888; color: white; font-size: 1em; font-weight: bold; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot;&gt;Linkage&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;&lt;b&gt;C++:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;Programs are statically linked, and metaprogramming facilities (reflection) are absent in the core language. So the names of classes, members, and variables need not be present in the compiled and linked program, except for names exported from dynamic libraries (DLLs/shared objects.)&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;&lt;b&gt;Java:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;Dependencies are resolved at run time, when classes are loaded. So the name of the class and names of its methods and fields must be present in a class file, as well as names of all imported classes, called methods, and accessed fields.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th colspan=&quot;2&quot; style=&quot;background-color: #228888; color: white; font-size: 1em; font-weight: bold; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot;&gt;Delivery Format&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;last&quot; style=&quot;line-height: 1.5em; margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;b&gt;C++:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;An application is delivered as a monolithic executable (maybe with a few dynamic libraries), so it is not easy to identify all member functions of a given class or reconstruct the class hierarchy.&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background-color: inherit; font-size: 1em; line-height: 1.5em; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;last&quot; style=&quot;line-height: 1.5em; margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;b&gt;Java:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;An application is delivered as a set of jar files, which are just non-encrypted archives containing individual classes.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;As a result, the decompilation of Java programs is a much simpler task compared to C++ and therefore may be fully automated. Class hierarchy, high-level statements, names of classes, methods and fields - all this can be&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;retrieved&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;from class files emitted by the standard&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;tt style=&quot;font-family: &#39;Lucida Console&#39;, Courier;&quot;&gt;javac&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;compiler. Any person of ordinary skills in programming can&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;download a Java decompiler, run your program through it and read the source code almost as if it was open source.&lt;/div&gt;&lt;div style=&quot;line-height: 1.5em; margin-bottom: 1.5em; margin-top: 0px;&quot;&gt;Let&#39;s see what can be done to prevent that.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/8449853169630435799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/8449853169630435799' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8449853169630435799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8449853169630435799'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/contents-introduction-bytecode.html' title='CONTENTS  Introduction  Bytecode Encryption- Straightforward But Totally Flawed  Name Obfuscation  String Encryption  Code and Data Flow Obfuscation  Strengthening Protection with Ahead-Of-Time Compilation  Popular Obfuscators  Further Reading  Appendices:  Obfuscation Examples  Impact of Flow Obfuscation on Performance  Protect Your Java Code - Through Obfuscators And Beyond'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-8324487159100001170</id><published>2011-05-08T21:14:00.000-07:00</published><updated>2011-05-08T21:14:05.482-07:00</updated><title type='text'>Java Decompiler New features in version 3.11.11.95</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://members.fortunecity.com/neshkov/Met3.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Java Annotation support. RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations, and RuntimeInvisibleParameterAnnotations attributes are supported.&lt;/li&gt;
&lt;li&gt;Improvements and many new features in &quot;View&quot; - &quot;Attributes&quot;, &quot;Methods, Interfaces and Constant Pool&quot; and &quot;Fields&quot; forms. Added search capabilities in &quot;Methods&quot; and &quot;Constant Pool&quot; tabs. Specific information for attributes is available and annotations are displayed in Treeview. &quot;Save to file&quot; option added. Bugfix in &quot;Exception Table&quot; tab. &quot;Attributes&quot; form gives a complete description of all ClassFile attributes. Additional &quot;Fields&quot; tab is added.&lt;/li&gt;
&lt;li&gt;Added a new search tool &quot;Search for files inside compressed archives&quot; (.JAR, .ZIP, .WAR, .EAR and .APK). This tool enables users to search for files by file name and a word or phrase in the file. The results list can be sorted by clicking at column header and includes detailed information about files.&lt;/li&gt;
&lt;li&gt;Added a new tool &quot;Imports Viewer&quot;. Lists import statements of selected class file.&lt;/li&gt;
&lt;li&gt;Added a new tool &quot;Methods Viewer&quot;. Shows the methods of selected class file with sorting capabilities. Lists access_flags, descriptors, method signatures, attributes and code length. The results list can be exported to tab-delimited text file.&lt;/li&gt;
&lt;li&gt;Added capability to calculate .DEX file signature and checksum with &quot;CRC MD5 SHA-1 Calculator&quot; tool. Users can also calculate the Adler-32 and SHA-256 hashes of a file or string.&lt;/li&gt;
&lt;li&gt;Improvements in &quot;Export to HTML&quot;. Compared to the previous version - it is much more powerful now. Unicode conversion allows multi-language documents.&lt;/li&gt;
&lt;li&gt;Added a drag-and-drop functionality in &quot;Archiver&quot; tool.&lt;/li&gt;
&lt;li&gt;Added a &quot;Tree View&quot; button in &quot;Archiver&quot;. Shows the selected archive (.jar, .zip, .war, .ear, .apk) in Treeview with export to .XML capability.&lt;/li&gt;
&lt;li&gt;Added a &quot;Whole class tree&quot; option in &quot;Decompile more files&quot; tool. Decompiles all .class files located in all subdirectories of the selected directory and creates output files in subdirectories of the destination folder according to package names of classes.&lt;/li&gt;
&lt;li&gt;&quot;Browse for files&quot; button added in &quot;Run&quot; tool. Useful to pass the file names as arguments to the main() method.&lt;/li&gt;
&lt;li&gt;Bugfixes in syntax highlighting.&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIdBUPeE8rQw6r9XqdatIbomc3wv5jiOqy3uStZMlrrOyQow9A1xKsPgtygRD8xZ-xInpUTETIIZrcupU0WpjUScPIKzom99hZs7Gcoi67-UlLLSca-jkYf-3AADx_-xSHC8O8ieUFWtA/s1600/java1.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;211&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIdBUPeE8rQw6r9XqdatIbomc3wv5jiOqy3uStZMlrrOyQow9A1xKsPgtygRD8xZ-xInpUTETIIZrcupU0WpjUScPIKzom99hZs7Gcoi67-UlLLSca-jkYf-3AADx_-xSHC8O8ieUFWtA/s400/java1.bmp&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFYpcM5Ms2HMU8P24-uOxmyMVZklqpEwZoZKovMYLuJSymgc4dt7tbGr89Ln1L8Sw-9_ThDjCKyzm1B1JuZMNccBeWN7FuERHpwqU8z4Za2dBUhLUU4pD8maeZHW-Xb4V-_-RcUxuOq_k/s1600/java.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFYpcM5Ms2HMU8P24-uOxmyMVZklqpEwZoZKovMYLuJSymgc4dt7tbGr89Ln1L8Sw-9_ThDjCKyzm1B1JuZMNccBeWN7FuERHpwqU8z4Za2dBUhLUU4pD8maeZHW-Xb4V-_-RcUxuOq_k/s400/java.bmp&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ol&gt;&lt;b&gt;&lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=7397206376271418817&quot; name=&quot;New310&quot;&gt; &lt;/a&gt;&lt;/b&gt;&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/8324487159100001170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/8324487159100001170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8324487159100001170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8324487159100001170'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/java-decompiler-new-features-in-version.html' title='Java Decompiler New features in version 3.11.11.95'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIdBUPeE8rQw6r9XqdatIbomc3wv5jiOqy3uStZMlrrOyQow9A1xKsPgtygRD8xZ-xInpUTETIIZrcupU0WpjUScPIKzom99hZs7Gcoi67-UlLLSca-jkYf-3AADx_-xSHC8O8ieUFWtA/s72-c/java1.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-5582053808616638519</id><published>2011-05-08T21:05:00.000-07:00</published><updated>2011-05-08T21:05:02.623-07:00</updated><title type='text'>Java Decompiler</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Introduction&lt;br /&gt;
&lt;br /&gt;
The “Java Decompiler project” aims to develop tools in order to decompile and analyze Java 5 “byte code” and the later versions.&lt;br /&gt;
&lt;br /&gt;
JD-Core is a library that reconstructs Java source code from one or more “.class” files. JD-Core may be used to recover lost source code and explore the source of Java runtime libraries. New features of Java 5, such as annotations, generics or type “enum”, are supported. JD-GUI and JD-Eclipse include JD-Core library.&lt;br /&gt;
&lt;br /&gt;
JD-GUI is a standalone graphical utility that displays Java source codes of “.class” files. You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields.&lt;br /&gt;
&lt;br /&gt;
JD-Eclipse is a plug-in for the Eclipse platform. It allows you to display all the Java sources during your debugging process, even if you do not have them all.&lt;br /&gt;
&lt;br /&gt;
JD-Core, JD-GUI and JD-Eclipse are free for non-commercial use. This means that JD-Core, JD-GUI and JD-Eclipse shall not be included or embedded into commercial software products. Nevertheless, these projects may be freely used for personal needs in a commercial or non-commercial environments.&lt;br /&gt;
&lt;br /&gt;
Main Features&lt;br /&gt;
&lt;br /&gt;
JD-Core and JD-GUI are written in C++. This allows an extremely fast decompilation and a display.&lt;br /&gt;
JD-Core does not require the Java runtime environment for its functioning, therefore no special setup is required.&lt;br /&gt;
JD-Core works with most current compilers including the following:&lt;br /&gt;
jdk1.1.8&lt;br /&gt;
jdk1.3.1&lt;br /&gt;
jdk1.4.2&lt;br /&gt;
jdk1.5.0&lt;br /&gt;
jdk1.6.0&lt;br /&gt;
jdk1.7.0&lt;br /&gt;
jikes-1.22&lt;br /&gt;
harmony-jdk-r533500&lt;br /&gt;
Eclipse Java Compiler v_677_R32x, 3.2.1 release&lt;br /&gt;
jrockit90_150_06&lt;br /&gt;
JD-Core supports the following new features of Java 5:&lt;br /&gt;
Annotations&lt;br /&gt;
Generics&lt;br /&gt;
Type “enum”&lt;br /&gt;
JD-GUI supports Drag and Drop.&lt;br /&gt;
JD-GUI supports JAR files.&lt;br /&gt;
JD-GUI displays color coded Java source code.&lt;br /&gt;
JD-GUI allows you to browse the “class” files hierarchy.&lt;br /&gt;
JD-GUI displays “log” files, and allow you to decompile “class” files appearing in Java stack traces.&lt;br /&gt;
JD-Core, JD-GUI and JD-Eclipse use the excellent cross-platform wxWidgets toolkit.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/5582053808616638519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/5582053808616638519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5582053808616638519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5582053808616638519'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/05/java-decompiler.html' title='Java Decompiler'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-7803574087124409175</id><published>2011-04-18T06:15:00.001-07:00</published><updated>2011-04-18T06:15:10.416-07:00</updated><title type='text'>Packaging and Distributing Java Desktop Applications</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; color: rgb(51, 51, 51); font-family: Verdana, &amp;#39;Verdana CE&amp;#39;, Arial, &amp;#39;Arial CE&amp;#39;, &amp;#39;Lucida Grande CE&amp;#39;, lucida, &amp;#39;Helvetica CE&amp;#39;, sans-serif; font-size: 11px; line-height: 18px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; &quot;&gt;&lt;h2 style=&quot;font-size: 1.45em; color: rgb(238, 107, 0); font-weight: normal; padding-top: 5px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; margin-top: 10px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(209, 209, 209); text-align: left; line-height: 16px; &quot;&gt; Creating Executable JAR File&lt;/h2&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;This part of the tutorial shows how you can create a distributable application in the IDE and then run that application from outside of the IDE. We will package the application in the form of an executable&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://download.oracle.com/javase/tutorial/deployment/jar/run.html&quot; target=&quot;_blank&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;JAR&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;file.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;A JAR file is an archive file that can contain multiple files and folders. JAR files are similar to zip files, but JAR files can have additional attributes that are useful for distributing Java applications. These attributes include digitally signing JAR files, additional compression, multiplatform compatibility, etc.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;In this exercise, you create an IDE project and then place two pre-written Java source files into that project. Then you will compile the classes and build an executable JAR file. Afterwards, you will learn how to run the JAR file from outside of the IDE.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;The classes used in this tutorial implement features of the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.gnu.org/software/grep/&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;GNU grep&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;utility, which can be used for searching text or regular expression patterns inside text files. The project contains both command-line and GUI versions of the application, so that you can see different ways of running the application.&lt;/p&gt; &lt;h3 class=&quot;tutorial&quot; style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; &lt;a name=&quot;setup&quot;&gt;&lt;/a&gt;Creating a Project with Existing Sources&lt;/h3&gt;&lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; &quot;&gt; Download the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://netbeans.org/projects/samples/downloads/download/Samples%252FJava%252FDeploymentTutorial.zip&quot; target=&quot;_blank&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;DeploymentTutorial.zip&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;file and extract its contents on your system.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; This zip archive contains source files for the application plus a few other files that will be used in the tutorial.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; &quot;&gt; In NetBeans IDE, choose File &amp;gt; New Project.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;In the Choose Category page, select Java Project With Existing Sources in the Java category and click Next.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt; On the Name and Location page of the wizard, type&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;AnotherGrep&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;as the project name and specify the project&amp;#39;s location.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; Leave the Set as Main Project checkbox selected and click Next.&lt;p class=&quot;tips&quot; style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px; padding-right: 0px; padding-bottom: 8px; padding-left: 34px; background-image: url(http://netbeans.org/images_www/v6/tips_small.gif); background-position: 0% 0%; background-repeat: no-repeat no-repeat; &quot;&gt; The project folder does&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;i&gt;not&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;have to be in the same location as the source files that you are importing into the project.&lt;/p&gt;&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;On the Existing Sources page of the wizard, specify the sources that will be in the project.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt;Click the Add Folder button that is to the right of the Source Package Folders field. Navigate to the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;DeploymentTutorial&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder that you have just unzipped on your system, expand the folder, select the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;src&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder, and click Open. The&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;src&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder is added to your Source Package Folders field.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Click Finish.&lt;br&gt;&lt;p class=&quot;notes&quot; style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 8px; padding-left: 32px; background-image: url(http://netbeans.org/images_www/v6/notes_small.gif); background-position: 0% 0%; background-repeat: no-repeat no-repeat; &quot;&gt; &lt;b style=&quot;font-size: 1em; &quot;&gt;Note:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;If, for example, you want to exclude some source files from importing into the project, click Next to open the last Includes &amp;amp; Excludes window. In our case, we want to use all the source files in the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;src&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder, so we click Finish to finish working in the New Project wizard.&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;The project opens in the IDE and becomes visibile in the Projects window. You can explore the contents of the project by expanding the project&amp;#39;s Source Packages node, where you should see classes called&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;Grep&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;xGrep&lt;/tt&gt;.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;Grep.java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;is a console version of the application.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;xGrep.java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;is a GUI version of the application and uses methods defined in&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;Grep.java&lt;/tt&gt;.&lt;/p&gt; &lt;h3 class=&quot;tutorial&quot; style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; &lt;a name=&quot;configure&quot;&gt;&lt;/a&gt;Configuring the Project&lt;/h3&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;There are a few configuration steps you need to do, such as:&lt;/p&gt; &lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Choose the Java platform that will be used to compile the sources.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Set the project&amp;#39;s main class. By doing this, you ensure that the JAR file that you create when you build the project is executable.&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-size: 1.15em; color: rgb(61, 61, 61); font-weight: bold; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; Verifying the Java Platform&lt;/h4&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;Our project needs to be compiled and run on Java 6 platform. Therefore, you need to make sure that Java 6 is used as the platform for this project.&lt;/p&gt; &lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Right-click the project&amp;#39;s node and choose Properties.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;On the Libraries tab, ensure that the Java Platform is JDK 6.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;On the Sources tab, choose JDK 6 in the Source/Binary format.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Click OK to close the Properties window.&lt;/li&gt;&lt;/ol&gt;&lt;h4 style=&quot;font-size: 1.15em; color: rgb(61, 61, 61); font-weight: bold; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; Setting the Main Class&lt;/h4&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;In order for a user to easily run your JAR file (by double-clicking the JAR file or by typing&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;java -jar AnotherGrep.jar&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;at the command line), a main class has to be specified inside the JAR&amp;#39;s&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;i&gt;manifest&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;file. (The manifest is a standard part of the JAR file that contains information about the JAR file that is useful for the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;launcher when you want to run the application.) The main class serves as an entry point from which the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;launcher runs your application.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;When you build a project, the IDE builds the JAR file and includes a manifest. When you set the project&amp;#39;s main class, you ensure that the main class is be designated in the manifest.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;To set the project&amp;#39;s main class:&lt;/p&gt;&lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt; Right-click the project&amp;#39;s node and choose Properties.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Select the Run panel and enter&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;anothergrep.xGrep&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;in the Main Class field.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Click OK to close the Project Properties dialog box.&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; When you build the project later in this tutorial, the manifest will be generated and include the following entry:&lt;/p&gt;&lt;pre class=&quot;examplecode&quot; style=&quot;background-color: rgb(255, 248, 228); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 1.1em; font-family: &amp;#39;Courier New&amp;#39;, monospace; color: black; overflow-x: auto; overflow-y: auto; width: 680px; white-space: pre; &quot;&gt; Main-Class: anothergrep.xGRep&lt;/pre&gt;&lt;h3 style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; &lt;a name=&quot;build&quot;&gt;&lt;/a&gt;Building the Project and Creating the JAR File&lt;/h3&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; Now that you have your sources ready and your project configured, it is time to build your project.&lt;/p&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; To build the project:&lt;/p&gt;&lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Choose Run &amp;gt; Build Main Project.&lt;br&gt; Alternatively, right-click the project&amp;#39;s node in the Projects window and choose Build.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; When you build your project:&lt;/p&gt;&lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;build&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;dist&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folders are added to your project folder (hereafter referred to as the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;i&gt;PROJECT_HOME&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder).&lt;/li&gt; &lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;All of the sources are compiled into&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;.class&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;files, which are placed into the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;&lt;i&gt;PROJECT_HOME&lt;/i&gt;/build&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;A JAR file containing your project is created inside the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;&lt;i&gt;PROJECT_HOME&lt;/i&gt;/dist&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;If you have specified any libraries for the project (in addition to the JDK), a&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;lib&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder is created in the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;dist&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder. The libraries are copied into&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;dist/lib&lt;/tt&gt;.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;The manifest file in the JAR is updated to include entries that designate main class and any libraries that are on the project&amp;#39;s classpath.&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;notes&quot; style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 8px; padding-left: 32px; background-image: url(http://netbeans.org/images_www/v6/notes_small.gif); background-position: 0% 0%; background-repeat: no-repeat no-repeat; &quot;&gt; &lt;b style=&quot;font-size: 1em; &quot;&gt;Note:&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;You can view the contents of the manifest in the IDE&amp;#39;s Files window. After you have built your project, switch to the Files window and navigate to&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;dist/AnotherGrep.jar&lt;/tt&gt;. Expand the node for the JAR file, expand the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;META-INF&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder, and double-click&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;MANIFEST.MF&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;to display the manifest in the Source Editor.&lt;/p&gt; &lt;pre class=&quot;examplecode&quot; style=&quot;background-color: rgb(255, 248, 228); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 1.1em; font-family: &amp;#39;Courier New&amp;#39;, monospace; color: black; overflow-x: auto; overflow-y: auto; width: 680px; white-space: pre; &quot;&gt; Main-Class: anothergrep.xGrep&lt;/pre&gt;(To find more about manifest files, you can read&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://java.sun.com/docs/books/tutorial/deployment/jar/manifestindex.html&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;this chapter&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;from the Java Tutorial.)&lt;h2 class=&quot;tutorial&quot; style=&quot;font-size: 1.45em; color: rgb(238, 107, 0); font-weight: normal; padding-top: 5px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; margin-top: 10px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(209, 209, 209); text-align: left; line-height: 16px; &quot;&gt; &lt;a name=&quot;run&quot;&gt;&lt;/a&gt;Running and Distributing the JAR File&lt;/h2&gt;&lt;h3 class=&quot;tutorial&quot; style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; Running the Application Inside of the IDE&lt;/h3&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;When developing applications in the IDE, typically you will need to test and refine them before distributing. You can easily test an application that you are working on by running the application from the IDE.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;To run the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;AnotherGrep&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;project in the IDE, right-click the project&amp;#39;s node in the Projects window and choose Run.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;The xGrep window should open. You can click the Browse button to choose a file in which to search for a text pattern. In the Search Pattern field, type text or a regular expression pattern that you would like to match, and click Search. The results of each match will appear in the xGrep window&amp;#39;s Output area.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;Information on regular expressions that you can use in this application are available&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.gnu.org/software/grep/manual/html_node/Regular-Expressions.html#Regular-Expressions&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;here&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and in many other places.&lt;/p&gt; &lt;h3 class=&quot;tutorial&quot; style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; Running the Application Outside of the IDE&lt;/h3&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;Once you have finished developing the application and before you distribute it, you will probably want to make sure that the application also works outside of the IDE.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;You can run the application outside of the IDE by following these steps:&lt;/p&gt; &lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;In your system&amp;#39;s file manager (for example, in the My Computer window on Windows XP systems), navigate to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;&lt;i&gt;PROJECT_HOME&lt;/i&gt;/dist&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and double-click the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;AnotherGrep.jar&lt;/tt&gt;file.&lt;/li&gt; &lt;/ul&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;You will know that the application has started successfully when the xGrep window opens.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;If the xGrep window does not open, your system probably does not have a file association between JAR files and the Java Runtime Environment. See&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://netbeans.org/kb/docs/java/javase-deploy.html#troubleshooting&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;Troubleshooting JAR File Associations&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;below.&lt;/p&gt; &lt;h3 class=&quot;tutorial&quot; style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; Distributing the Application to Other Users&lt;/h3&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;Now that you have verified that the application works outside of the IDE, you are ready to distribute it.&lt;/p&gt; &lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Send the application&amp;#39;s JAR file to the people who will use the application. The users of your application should be able to run it by double-clicking the JAR file. If this does not work for them, show them the information in the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://netbeans.org/kb/docs/java/javase-deploy.html#troubleshooting&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;Troubleshooting JAR File Associations&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;section below.&lt;/li&gt; &lt;/ul&gt;&lt;p class=&quot;notes&quot; style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 8px; padding-left: 32px; background-image: url(http://netbeans.org/images_www/v6/notes_small.gif); background-position: 0% 0%; background-repeat: no-repeat no-repeat; &quot;&gt; &lt;strong&gt;Note:&lt;/strong&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;If your application depends on additional libraries other than those included in JDK, you need to also include them in your distribution (not the case in our example). The relative paths to these libraries are added in the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;classpath&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;entry of the JAR&amp;#39;s manifest file when you are developing your applicaiton in the IDE. If these additional libraries will not be found at the specified classpath (i.e., relative path) at launch, the application will not start.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; Create a zip archive that contains the application JAR file and the library and provide this zip file to users. Instruct the users to unpack the zip file making sure that the JAR file and libraries JAR files are in the same folder. Run the application JAR file.&lt;/p&gt; &lt;h2 style=&quot;font-size: 1.45em; color: rgb(238, 107, 0); font-weight: normal; padding-top: 5px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; margin-top: 10px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(209, 209, 209); text-align: left; line-height: 16px; &quot;&gt; &lt;a name=&quot;startapp&quot;&gt;&lt;/a&gt;Starting Your Java Application&lt;/h2&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; The goal of this exercise is to show you some ways that you can start your application from the command line.&lt;/p&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; This exercise shows you how you can start a Java application in the following two ways:&lt;/p&gt;&lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt; Running the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;command from the command line.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Using a script to a call a class in the JAR file.&lt;/li&gt;&lt;/ul&gt;&lt;h3 class=&quot;tutorial&quot; style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; &lt;a name=&quot;commandline&quot; id=&quot;commandline&quot;&gt;&lt;/a&gt;Launching Applications From the Command Line&lt;/h3&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; You can launch an application from the command line by using the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;command. If you want to run an executable JAR file, use the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;-jar&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;option of the command.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;For example, to run the AnotherGrep application, you would take the following steps:&lt;/p&gt; &lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Open a terminal window. On Microsoft Windows systems, you do this by choosing Start &amp;gt; Run, typing&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;cmd&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;in the Open field, and clicking OK.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Change directories to the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;&lt;i&gt;PROJECT_HOME&lt;/i&gt;/dist&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;folder (using the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;cd&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;command).&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Type the following line to run the application&amp;#39;s main class:&lt;pre class=&quot;examplecode&quot; style=&quot;background-color: rgb(255, 248, 228); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 1.1em; font-family: &amp;#39;Courier New&amp;#39;, monospace; color: black; overflow-x: auto; overflow-y: auto; width: 680px; white-space: pre; &quot;&gt; java -jar AnotherGrep.jar&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;If you follow these steps and the application does not run, you probably need to do one of the following things:&lt;/p&gt; &lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Include the full path to the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;binary in the third step of the procedure. For example, you would type something like the following, depending on where your JDK or JRE is located:&lt;pre class=&quot;examplecode&quot; style=&quot;background-color: rgb(255, 248, 228); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 1.1em; font-family: &amp;#39;Courier New&amp;#39;, monospace; color: black; overflow-x: auto; overflow-y: auto; width: 680px; white-space: pre; &quot;&gt; C:\Program Files\Java\jdk1.6.0_23\bin\java -jar AnotherGrep.jar&lt;/pre&gt;&lt;/li&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Add the Java binaries to your PATH environment variable, so that you never have to specify the path to the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;binary from the command line. See&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://netbeans.org/kb/docs/java/javase-deploy.html#path&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;Setting the PATH Environment Variable&lt;/a&gt;.&lt;/li&gt; &lt;/ul&gt;&lt;h3 class=&quot;tutorial&quot; style=&quot;font-size: 1.3em; color: rgb(45, 63, 142); font-weight: normal; padding-top: 10px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; &quot;&gt; &lt;a name=&quot;script&quot;&gt;&lt;/a&gt;Launching Applications From a Script&lt;/h3&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; If the application that you want to distribute is a console application, you might find that it is convenient to start the application from a a script, particularly if the application takes long and complex arguments to run. In this section, you will use a console version of the Grep program, where you need to pass the arguments (search pattern and file list) to the JAR file, which will be invoked in our script. To reduce typing at the command line, you will use a simple script suitable to run the test application.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;First you need to change the main class in the application to be the console version of the class and rebuild the JAR file:&lt;/p&gt; &lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;In the IDE&amp;#39;s Projects window, right-click the project&amp;#39;s node (&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;AnotherGrep&lt;/tt&gt;) and choose Properties.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Select the Run node and change the Main Class property to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;anothergrep.Grep&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;(from&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;anothergrep.xGrep&lt;/tt&gt;). Click OK to close the Project Properties window.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Right-click the project&amp;#39;s node again and choose Clean and Build Project.&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; After completing these steps, the JAR file is rebuilt, and the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;Main-Class&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;attribute of the JAR file&amp;#39;s manifest is changed to point to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;anothergrep.Grep&lt;/tt&gt;.&lt;/p&gt; &lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/7803574087124409175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/7803574087124409175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/7803574087124409175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/7803574087124409175'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/packaging-and-distributing-java-desktop.html' title='Packaging and Distributing Java Desktop Applications'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-3127124805376434544</id><published>2011-04-18T06:14:00.001-07:00</published><updated>2011-04-18T06:14:06.490-07:00</updated><title type='text'>Java Web Start</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; &quot;&gt;&lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt; &lt;b&gt;Java Web Start (JWS)&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and the underlying&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;Java Network Launch Protocol (JNLP)&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;enable Java application delivery from a standard Web server. The end user initiates application installation by clicking on an URL. If the Java Web Start engine is not present on the system, the user is prompted to download and install it. Once Java Web Start is in place, clicking on the same URL will initiate the application download and installation procedures. It may involve download and installation of the required version of the JRE and Optional Packages. Upon their successful completion, the application is launched. The application will be cached on the user&amp;#39;s system so next time the user clicks on the same URL, the JWS engine will launch the local copy of the application from the cache, if it detects that the computer is offline or the application was not updated on the Web site.&lt;/p&gt; &lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt;Another important feature of JWS is its ability to run your application in a&lt;i&gt;sandbox&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;- a restricted container based on Java security architecture. But, unlike an applet, your application can gain access to local system resources like the filesystem, printer and system clipboard using the JNLP API even if it comes from an untrusted environment, after prompting the user for confirmation.&lt;/p&gt; &lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt;Java Web Start is available for Windows, Linux, and Solaris, and is part of MacOS X since v10.1. There are also third-party implementations of the JNLP protocol, some of them also include tools that assist you in the creation and maintenance of JNLP packages.&lt;/p&gt; &lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt;That was the bright side. Now, what is not so good about JNLP? First off, for seamless operation both the browser and the Web server that hosts the JNLP-enabled application must support&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Lucida Console&amp;#39;, Courier; &quot;&gt;application/x-java-jnlp-file&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;MIME type. Some hosting providers do not support it. Moreover, versioning and incremental updates require additional support from the Web server, which has to be implemented using servlets, cgi-bin scripts, etc.&lt;/p&gt; &lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt;On the client side, a major browser would be configured to recognize the above MIME type during installation of the JWS engine, but users of less popular browsers, such as Opera, may have to do that manually.&lt;/p&gt; &lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt;JNLP-enabling an application may involve minor changes in its code and (re)packaging it into a set of jar files.&lt;/p&gt;&lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt; Before J2SE 5.0, JWS had very little to offer in terms of desktop integration - all it could do was create a desktop icon and/or a Start Menu entry for the application. On Windows, the application will not show up in Add/Remove Programs, so end users would have to run the Java Web Start application manager in order to remove your application.&lt;/p&gt; &lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt;Finally, JWS user interface needs much polishing. As of J2SE 5.0, users still complain about ugly windows with incomprehensible messages.&lt;/p&gt;&lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt; To sum it up, JWS can be a viable option in a controlled environment, such as corporate intranet, but it is not ready for the consumer market, where you may be better off using&lt;/p&gt;&lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/3127124805376434544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/3127124805376434544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3127124805376434544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3127124805376434544'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/java-web-start.html' title='Java Web Start'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-181576397489048492</id><published>2011-04-18T06:13:00.001-07:00</published><updated>2011-04-18T06:13:23.417-07:00</updated><title type='text'>Advanced Debugging</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, Geneva, sans-serif; font-size: small; &quot;&gt;&lt;div class=&quot;sect1&quot; lang=&quot;en&quot;&gt; &lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;Skip all breakpoints&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;If you want to temporary de-activate all your breakpoints you can press the button &amp;quot;Skip all breakpoints&amp;quot; which is visible if you select the tab breakpoints.&lt;/p&gt; &lt;p&gt;If you press this button again the breakpoints will get activated again.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/skipbreakpoints10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;advanced_properties&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;4.2. Breakpoint Properties&lt;/h3&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;After setting a breakpoint you can select the properties of the breakpoint to for example use a condition to restrict when the breakpoint should get toggeled. In the properties you can for example restrict that the breakpoint should only be executed the 12 hit (Hit Count) or you can put in a conditional expression (which you can also use for logging if you want).&lt;/p&gt; &lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/debug10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt;&lt;div class=&quot;mediaobject&quot;&gt; &lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/debug20.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt; &lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;advanced_watchpoint&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;4.3. Watchpoint&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;A watchpoint is a breakpoint at which is stop whenever a field read or changed. You can set a watchpoint through a double-click on the left side before the field declaration. Via the properties of the watchpoint you can define if the breakpoint should be hit during read access (Field Access) or during write access (Field Modification).&lt;/p&gt; &lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/watchpoint10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;advanced_exception&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;4.4. Exception Breakpoint&lt;/h3&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;The application is stopped if the specified exception is thrown. To define an exception breakpoint click on the following icon.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/exception10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;p&gt;You can define if you want to stop and caught and / or uncaught exceptions.&lt;/p&gt;&lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;advanced_method&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;4.5. Method Breakpoint&lt;/h3&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;A method breakpoint is defined via double-click in the left border of the editor and the method head. You can define if you want to stop the program during method entry of after leaving the method.&lt;/p&gt; &lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/methodbreakpoint10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;advanced_class&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;4.6. Class breakpoint&lt;/h3&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;p&gt;A Class Load Breakpoint will stop when the class is loaded. Right-click on a class in the Outline View and choose &amp;quot;Toggle Class Load Breakpoint&amp;quot;&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/classloadbreakpoint.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;advanced_hitcount&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;4.7. Hit Count&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt;&lt;p&gt;For every breakpoint you can define via the properties the hit count. If you use the hit count then the application is stop then the breakpoint is reached the number of times defined in the hit count.&lt;/p&gt;&lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt; &lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;advanced_droptoframe&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;4.8. Drop to frame&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Eclipse allows you to select any level (frame) in the call stack during debugging and set the JVM to restart to that point.&lt;/p&gt; &lt;p&gt;This allows you to rerun a part of your program. Be aware that variables which have been modified by the code which you reset remain modified. The drop to frame will return to the the code. Changes made by the code, e.g. to variables / databases will not be reset.&lt;/p&gt; &lt;p&gt;To use the feature select the level in your stack and press the highlighted button.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/droptoframe10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;sect1&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h2 class=&quot;title&quot; style=&quot;background-color: rgb(229, 236, 249); border-top-width: 1px; border-top-style: solid; border-top-color: rgb(51, 102, 204); font-size: 17px; font-weight: bold; padding-top: 1px; padding-right: 3px; padding-bottom: 1px; padding-left: 3px; position: relative; clear: both; &quot;&gt; &lt;a name=&quot;thankyou&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/181576397489048492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/181576397489048492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/181576397489048492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/181576397489048492'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/advanced-debugging.html' title='Advanced Debugging'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-3813141618769623602</id><published>2011-04-18T06:12:00.002-07:00</published><updated>2011-04-18T06:23:11.797-07:00</updated><title type='text'>Add dynamic Java code to your application</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; text-align: left; &quot;&gt;&lt;p class=&quot;first&quot; style=&quot;margin-top: 10px; margin-bottom: 15px; font-size: 12px; line-height: 20px; padding-bottom: 8px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: rgb(224, 224, 224); &quot;&gt; JavaServer Pages (JSP) is a more flexible technology than servlets because it can respond to dynamic changes at runtime. Can you imagine a common Java class that has this dynamic capability too? It would be interesting if you could modify the implementation of a service without redeploying it and update your application on the fly.&lt;/p&gt; &lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;The article explains how to write dynamic Java code. It discusses runtime source code compilation, class reloading, and the use of the Proxy design pattern to make modifications to a dynamic class transparent to its caller.&lt;/p&gt; &lt;h3 style=&quot;font-size: 12px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;An example of dynamic Java code&lt;/h3&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt; Let&amp;#39;s start with an example of dynamic Java code that illustrates what true dynamic code means and also provides some context for further discussions. Please find this example&amp;#39;s complete source code in&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.javaworld.com/javaworld/jw-06-2006/jw-0612-dynamic.html#resources&quot; style=&quot;text-decoration: none; color: rgb(3, 90, 135); &quot;&gt;Resources&lt;/a&gt;.&lt;/p&gt; &lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;The example is a simple Java application that depends on a service called Postman. The Postman service is described as a Java interface and contains only one method,&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;deliverMessage()&lt;/code&gt;:&lt;/p&gt; &lt;div id=&quot;codewrap&quot; style=&quot;overflow-x: auto; overflow-y: auto; width: auto; height: auto; margin-top: -3px; margin-right: 0px; margin-bottom: 25px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 102, 102); border-right-color: rgb(102, 102, 102); border-bottom-color: rgb(102, 102, 102); border-left-color: rgb(102, 102, 102); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(241, 242, 243); background-position: initial initial; background-repeat: initial initial; &quot;&gt; &lt;div id=&quot;codewrap7&quot;&gt;&lt;pre style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt; &lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;public interface Postman {     void deliverMessage(String msg); } &lt;/code&gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;A simple implementation of this service prints messages to the console. The implementation class is the dynamic code. This class,&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;PostmanImpl&lt;/code&gt;, is just a normal Java class, except it deploys with its source code instead of its compiled binary code:&lt;/p&gt; &lt;div id=&quot;codewrap&quot; style=&quot;overflow-x: auto; overflow-y: auto; width: auto; height: auto; margin-top: -3px; margin-right: 0px; margin-bottom: 25px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 102, 102); border-right-color: rgb(102, 102, 102); border-bottom-color: rgb(102, 102, 102); border-left-color: rgb(102, 102, 102); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(241, 242, 243); background-position: initial initial; background-repeat: initial initial; &quot;&gt; &lt;div id=&quot;codewrap13&quot;&gt;&lt;pre style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt; &lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;public class PostmanImpl implements Postman {&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;  &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;    private PrintStream output;          public PostmanImpl() {         output = System.out;     }          public void deliverMessage(String msg) {         output.println(&amp;quot;[Postman] &amp;quot; + msg);         output.flush();     } } &lt;/code&gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;The application that uses the Postman service appears below. In the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;main()&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;method, an infinite loop reads string messages from the command line and delivers them through the Postman service:&lt;/p&gt; &lt;div id=&quot;codewrap&quot; style=&quot;overflow-x: auto; overflow-y: auto; width: auto; height: auto; margin-top: -3px; margin-right: 0px; margin-bottom: 25px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 102, 102); border-right-color: rgb(102, 102, 102); border-bottom-color: rgb(102, 102, 102); border-left-color: rgb(102, 102, 102); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(241, 242, 243); background-position: initial initial; background-repeat: initial initial; &quot;&gt; &lt;div id=&quot;codewrap21&quot;&gt;&lt;pre style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt; &lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;public class PostmanApp {&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;  &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;    public static void main(String[] args) throws Exception {         BufferedReader sysin = new BufferedReader(new InputStreamReader(System.in));&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt; &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;        // Obtain a Postman instance         Postman postman = getPostman();&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt; &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;        while (true) {             System.out.print(&amp;quot;Enter a message: &amp;quot;);             String msg = sysin.readLine();             postman.deliverMessage(msg);         }     }&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt; &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;    private static Postman getPostman() {         // Omit for now, will come back later     }  } &lt;/code&gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;Execute the application, enter some messages, and you will see outputs in the console such as the following (you can&lt;a href=&quot;http://www.javaworld.com/javaworld/jw-06-2006/jw-0612-dynamic.html#resources&quot; style=&quot;text-decoration: none; color: rgb(3, 90, 135); &quot;&gt;download&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;the example and run it yourself):&lt;/p&gt; &lt;div id=&quot;codewrap&quot; style=&quot;overflow-x: auto; overflow-y: auto; width: auto; height: auto; margin-top: -3px; margin-right: 0px; margin-bottom: 25px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 102, 102); border-right-color: rgb(102, 102, 102); border-bottom-color: rgb(102, 102, 102); border-left-color: rgb(102, 102, 102); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(241, 242, 243); background-position: initial initial; background-repeat: initial initial; &quot;&gt; &lt;div id=&quot;codewrap35&quot;&gt;&lt;pre style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt; &lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;[DynaCode] Init class sample.PostmanImpl Enter a message: hello world [Postman] hello world Enter a message: what a nice day! [Postman] what a nice day! Enter a message:  &lt;/code&gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;Everything is straightforward except for the first line, which indicates that the class&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;PostmanImpl&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;is compiled and loaded.&lt;/p&gt; &lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;Now we are ready to see something dynamic. Without stopping the application, let&amp;#39;s modify&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;PostmanImpl&lt;/code&gt;&amp;#39;s source code. The new implementation delivers all the messages to a text file, instead of the console:&lt;/p&gt; &lt;div id=&quot;codewrap&quot; style=&quot;overflow-x: auto; overflow-y: auto; width: auto; height: auto; margin-top: -3px; margin-right: 0px; margin-bottom: 25px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 102, 102); border-right-color: rgb(102, 102, 102); border-bottom-color: rgb(102, 102, 102); border-left-color: rgb(102, 102, 102); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(241, 242, 243); background-position: initial initial; background-repeat: initial initial; &quot;&gt; &lt;div id=&quot;codewrap43&quot;&gt;&lt;pre style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt; &lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;// MODIFIED VERSION public class PostmanImpl implements Postman {&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt; &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;    private PrintStream output;          // Start of modification     public PostmanImpl() throws IOException {         output = new PrintStream(new FileOutputStream(&amp;quot;msg.txt&amp;quot;));     }     // End of modification&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt; &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;    public void deliverMessage(String msg) {         output.println(&amp;quot;[Postman] &amp;quot; + msg);&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt; &lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;        output.flush();     } } &lt;/code&gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;br style=&quot;line-height: 0px; height: 0px; &quot;&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;Shift back to the application and enter more messages. What will happen? Yes, the messages go to the text file now. Look at the console&lt;/p&gt; &lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/3813141618769623602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/3813141618769623602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3813141618769623602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3813141618769623602'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/add-dynamic-java-code-to-your.html' title='Add dynamic Java code to your application'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-5307508532820980038</id><published>2011-04-18T06:12:00.001-07:00</published><updated>2011-04-18T06:12:24.382-07:00</updated><title type='text'>JDK 7 Support in NetBeans IDE 7.0:</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; color: rgb(51, 51, 51); font-family: Verdana,&amp;#39;Verdana CE&amp;#39;,Arial,&amp;#39;Arial CE&amp;#39;,&amp;#39;Lucida Grande CE&amp;#39;,lucida,&amp;#39;Helvetica CE&amp;#39;,sans-serif; font-size: 11px; line-height: 18px;&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; &lt;strong&gt;To enable JDK 7 support in the NetBeans IDE:&lt;/strong&gt;&lt;/p&gt;&lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Download the JDK 7 binary for your platform from&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://dlc.sun.com.edgesuite.net/jdk7/binaries/index.html&quot; target=&quot;_blank&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;this page&lt;/a&gt;.&lt;br&gt; This is the latest promoted development build.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Install JDK 7 on your system.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;In the IDE, choose Tools &amp;gt; Java Platforms from the main menu.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Click Add Platform and specify the directory that contains the JDK (e.g. on Windows, this is the JDK installation directory, default is&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;C:\Program Files\Java\jdk1.7.0&lt;/tt&gt;).&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; The directory that contains the Java platform is marked with the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/platform.gif&quot; alt=&quot;Java Platform icon&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;icon.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;In the Platform Name step, verify that the default locations of the Platform Sources zip file and API documentation are valid.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt; Click Finish to close the Add Java Platform dialog box.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px;&quot;&gt;Ensure JDK 1.7 is chosen in the Platforms list and click Close.&lt;/li&gt;&lt;/ol&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; color: rgb(51, 51, 51); font-family: Verdana, &amp;#39;Verdana CE&amp;#39;, Arial, &amp;#39;Arial CE&amp;#39;, &amp;#39;Lucida Grande CE&amp;#39;, lucida, &amp;#39;Helvetica CE&amp;#39;, sans-serif; font-size: 11px; line-height: 18px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; &quot;&gt;&lt;h2 style=&quot;font-size: 1.45em; color: rgb(238, 107, 0); font-weight: normal; padding-top: 5px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; margin-top: 10px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(209, 209, 209); text-align: left; line-height: 16px; &quot;&gt; Configuring the Project to Use JDK 7&lt;/h2&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;Once you have registered JDK 7 in the IDE, you need to configure your project to use this JDK for compilation, running, and debugging.&lt;/p&gt; &lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Create a Java project. Choose File &amp;gt; New Project and select Java Application as the project type. Click Next.&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt; Type&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;SwitchTest&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;as the project name and specify its location.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;In the Files window, right-click the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;SwitchTest&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;project&amp;#39;s node and choose Properties &amp;gt; Libraries. On this tab, choose JDK 1.7 from the list of Java Platforms.&lt;br&gt; &lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/props-libs.png&quot; alt=&quot;Setting JDK 7 as the target format.&quot; class=&quot;margin-around&quot; style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; &quot;&gt;&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Switch to the Sources tab of the Project Properties window and choose JDK 7 as the Source/Binary Format.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt;&lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/props-sources.png&quot; alt=&quot;Specifying JDK 7 as the source format&quot; class=&quot;margin-around&quot; style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; &quot; height=&quot;431&quot; width=&quot;573&quot;&gt;&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Click OK to save changes. Your project is set to recognize new JDK 7 language features.&lt;br&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h2 style=&quot;font-size: 1.45em; color: rgb(238, 107, 0); font-weight: normal; padding-top: 5px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; margin-top: 10px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(209, 209, 209); text-align: left; line-height: 16px; &quot;&gt; &lt;a name=&quot;switch&quot;&gt;&lt;/a&gt;Using New JDK 7 Language Constructs: Switch Statement&lt;/h2&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; JDK 7 brings a number of&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://openjdk.java.net/projects/jdk7/features/&quot; target=&quot;_blank&quot; style=&quot;color: rgb(30, 42, 96); font-weight: normal; text-decoration: underline; &quot;&gt;new features and enhancements&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;in different areas, including internationalization, I/O and networking, security, etc. The best way to illustrate the JDK 7 support by the IDE&amp;#39;s Java Editor is to demonstrate a few language changes introduced by Project Coin.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;One of these changes is a &amp;quot;String in a switch&amp;quot;. In the previous versions of Java, the argument of&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;switch&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;had to be only of the following primitive data types:&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;byte&lt;/tt&gt;,&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;short&lt;/tt&gt;,&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;char&lt;/tt&gt;,&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;int&lt;/tt&gt;, or&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;enum&lt;/tt&gt;. Starting from JDK 7, you can use arguments of type&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;String&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;in the expression of a&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;switch&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;statement.&lt;/p&gt; &lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Open&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;SwitchTest.java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and add the following code. This small sample displays RGB codes for several colors.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; With JDK 7, the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;color&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;variable can be a&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;String&lt;/tt&gt;.&lt;pre class=&quot;examplecode&quot; style=&quot;background-color: rgb(255, 248, 228); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 1.1em; font-family: &amp;#39;Courier New&amp;#39;, monospace; color: black; overflow-x: auto; overflow-y: auto; width: 680px; white-space: pre; &quot;&gt; package switchtest;      public class SwitchTest {      public static void main(String[] args) {          String color = &amp;quot;red&amp;quot;;         String colorRGB;         switch (color.toLowerCase()) {             case &amp;quot;black&amp;quot;: colorRGB = &amp;quot;000000&amp;quot;; break;             case &amp;quot;red&amp;quot;: colorRGB = &amp;quot;ff0000&amp;quot;; break;             case &amp;quot;green&amp;quot;: colorRGB = &amp;quot;008000&amp;quot;; break;             case &amp;quot;blue&amp;quot;: colorRGB = &amp;quot;0000ff&amp;quot;; break;             default: colorRGB = &amp;quot;Invalid color&amp;quot;; break;         }         System.out.println(colorRGB);         }     } &lt;/pre&gt;&lt;p class=&quot;tips&quot; style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px; padding-right: 0px; padding-bottom: 8px; padding-left: 34px; background-image: url(http://netbeans.org/images_www/v6/tips_small.gif); background-position: 0% 0%; background-repeat: no-repeat no-repeat; &quot;&gt; If the pasted code is formatted incorrectly in the editor, press Alt-Shift-F to reformat.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;In the Files window, right-click the project&amp;#39;s node and choose Run. You will see the output of the application, which is the RGB code for the red color.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; You can see that the build is successful and the application works when the target platform and source format is JDK 7.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt;&lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/output.png&quot; alt=&quot;Output of running the project.&quot; class=&quot;margin-around&quot; style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; &quot; height=&quot;82&quot; width=&quot;326&quot;&gt;&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Let&amp;#39;s rollback to using JDK 6 and test how the application is complied with the JDK 6 compiler.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt;In the Files window, right-click the project&amp;#39;s node and choose Properties. On the Libraries tab, set the Java Platform to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;JDK 1.6&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and on the Sources tab, set the Source Format option to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;JDK 6&lt;/tt&gt;.&lt;br&gt; You can immediately see that the JDK6 parser does not recognize the syntax. The compilation fails because of the incompatible variable type.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt;&lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/error.png&quot; alt=&quot;Output of running the project.&quot; class=&quot;margin-around&quot; style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; &quot; height=&quot;142&quot; width=&quot;482&quot;&gt;&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Now, let&amp;#39;s rewrite the code using the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;if-then-else&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;statement instead of&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;switch&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;as shown in the picture.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; With JDK 7 being the target platform, the IDE recognizes such cases and offers you to convert them to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;switch&lt;/tt&gt;.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; Click the hint and the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;if-then-else&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;construct will be automatically converted to exactly the same&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;switch&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;that we had before.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/convert.png&quot; alt=&quot;Converting the if-then-else to switch&quot; class=&quot;margin-around&quot; style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; &quot; height=&quot;320&quot; width=&quot;398&quot;&gt;&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Run the application with different values.&lt;/li&gt;&lt;/ol&gt;&lt;h2 style=&quot;font-size: 1.45em; color: rgb(238, 107, 0); font-weight: normal; padding-top: 5px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; margin-top: 10px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(209, 209, 209); text-align: left; line-height: 16px; &quot;&gt; &lt;a name=&quot;more&quot; id=&quot;more&quot;&gt;&lt;/a&gt;JDK 7 Support: More Examples&lt;/h2&gt;&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt; To demonstrate how the IDE&amp;#39;s Java Editor recognizes and automatically fixes code to be compliant with the JDK 7 language spec, let&amp;#39;s use a dummy code snippet, which is meaningless but contains all the major language improvements.&lt;/p&gt; &lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; &quot;&gt;When walking through this dummy code snippet and applying editor hints, you will see the following examples of how to:&lt;/p&gt; &lt;ul style=&quot;padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; &quot;&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Take advantage of automatic type inference, when the Java compiler is able to infer the type of a generic instance without the need to explicitly specify it. The so-called&lt;em&gt;diamond operator&lt;/em&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;is used to flag the type inference case.&lt;/li&gt; &lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Use improved exception handling or&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;em&gt;multi-catch&lt;/em&gt;, when one&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;catch&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;block can be used for several types of exceptions.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;/li&gt;&lt;li style=&quot;margin-bottom: 10px; margin-top: 0px; &quot;&gt;Use the new syntax of resource closure statements introduced by the Automatic Resource Management feature.&lt;/li&gt;&lt;/ul&gt;&lt;ol&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt; Replace the previous application code in the same&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;tt style=&quot;font-family: &amp;#39;Courier New&amp;#39;, monospace; font-size: 1.1em; color: black; &quot;&gt;SwitchTest.java&lt;/tt&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;file with the following&lt;br&gt; &lt;pre class=&quot;examplecode&quot; style=&quot;background-color: rgb(255, 248, 228); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 1.1em; font-family: &amp;#39;Courier New&amp;#39;, monospace; color: black; overflow-x: auto; overflow-y: auto; width: 680px; white-space: pre; &quot;&gt; package switchtest;   import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List;   public class SwitchTest {       public static void main(String[] args) throws IOException {         List list = new ArrayList();         HashMap map = new HashMap();         HashMap map2 = new HashMap();         String a = &amp;quot;ehlo&amp;quot;;          try {             throw new FileNotFoundException(&amp;quot;adasdf&amp;quot;);         } catch (FileNotFoundException fnfo) {             fnfo.printStackTrace();         } catch (IOException ioe) {             ioe.printStackTrace();         }          FileInputStream in = null;         try {             in = new FileInputStream(&amp;quot;foo.txt&amp;quot;);              int k;             while ((k = in.read()) != -1) {                 System.out.write(k);             }         } finally {             if (in != null) {                 in.close();             }         }     } }  &lt;/pre&gt;&lt;/li&gt;&lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Note that the IDE displays several hints of how you can optimize your code for the JDK 7 spec. Simply, click on each hint and select the suggested action.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/hints.png&quot; alt=&quot;IDE&amp;#39;s hints on conversion&quot; class=&quot;margin-around&quot; style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; &quot; height=&quot;131&quot; width=&quot;543&quot;&gt;&lt;/li&gt; &lt;li style=&quot;margin-bottom: 9px; margin-top: 0px; &quot;&gt;Finally, after you accept all the suggestions, you should receive the JDK 7 compatible code that is similar to the one shown below.&lt;br&gt;&lt;img src=&quot;http://netbeans.org/images_www/articles/70/java/javase-jdk7/converted.png&quot; alt=&quot;Converted code snippet&quot; class=&quot;margin-around&quot; style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; &quot; height=&quot;345&quot; width=&quot;513&quot;&gt;&lt;/li&gt; &lt;/ol&gt;&lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/5307508532820980038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/5307508532820980038' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5307508532820980038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5307508532820980038'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/jdk-7-support-in-netbeans-ide-70.html' title='JDK 7 Support in NetBeans IDE 7.0:'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-8976730361616059875</id><published>2011-04-18T06:10:00.001-07:00</published><updated>2011-04-18T06:10:41.898-07:00</updated><title type='text'>Convert Java to EXE</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; &quot;&gt;&lt;div class=&quot;accent1&quot; style=&quot;border-top-color: rgb(255, 122, 0); border-right-color: rgb(255, 122, 0); border-bottom-color: rgb(255, 122, 0); border-left-color: rgb(255, 122, 0); background-color: rgb(255, 241, 229); &quot;&gt; &lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot; align=&quot;CENTER&quot;&gt;f you are sure you need a&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;real&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;EXE, go straight to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.excelsior-usa.com/articles/java-to-exe.html#aot&quot; style=&quot;text-decoration: none; color: rgb(255, 122, 0); cursor: pointer; &quot;&gt;&lt;b&gt;AOT Compilers&lt;/b&gt;&lt;/a&gt;.&lt;/p&gt; &lt;/div&gt;&lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt;&amp;quot;How do I make an .EXE file from my Java application?&amp;quot;, &amp;quot;Need help converting jar to exe&amp;quot;, &amp;quot;Is it possible to create a Windows executable using Java?&amp;quot; --- these and similar questions are among the most popular topics on Java developer forums. Should you start such a topic today, you are likely to encounter the following three types of replies:&lt;/p&gt; &lt;ul style=&quot;margin-top: 0px; margin-bottom: 1.5em; padding-left: 0em; margin-left: 2em; &quot;&gt;&lt;li style=&quot;line-height: 1.5em; margin-bottom: 0.5em; &quot;&gt;&amp;quot;You cannot&amp;quot;&lt;/li&gt;&lt;li style=&quot;line-height: 1.5em; margin-bottom: 0.5em; &quot;&gt; &amp;quot;You should not, because that would kill the very purpose of Java&amp;quot;&lt;/li&gt;&lt;li style=&quot;line-height: 1.5em; margin-bottom: 0.5em; &quot;&gt;&amp;quot;You can do that with third party software X and Y&amp;quot;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;line-height: 1.5em; margin-top: 0px; margin-bottom: 1.5em; &quot;&gt; The truth is that there exist two completely different approaches to the creation of native executables from Java applications, addressing different sets of problems. Moreover, under certain conditions some of those problems may be solved without making an EXE. So the most correct way to reply to such a post would be a request for more information, namely what is the goal of conversion to EXE. And the most frequent answer would be&lt;/p&gt; &lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/8976730361616059875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/8976730361616059875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8976730361616059875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8976730361616059875'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/convert-java-to-exe.html' title='Convert Java to EXE'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-439530025582763104</id><published>2011-04-18T06:09:00.001-07:00</published><updated>2011-04-18T06:09:47.776-07:00</updated><title type='text'>Debug</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, Geneva, sans-serif; font-size: small; &quot;&gt;&lt;div class=&quot;sect1&quot; lang=&quot;en&quot;&gt; &lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;Setting Breakpoints&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;To set breakpoints right click in the small left column in your source code editor and select toggle breakpoint. Or you can double click on this place.&lt;/p&gt; &lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/setbreakpoint10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;usedebug_start&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;3.2. Starting the Debugger&lt;/h3&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;You can debug your application with selecting your Java file which contains a main method, right click it and select Run -&amp;gt; Debug.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/debugstart10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;div class=&quot;tip&quot; style=&quot;border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: gray; border-right-color: gray; border-bottom-color: gray; border-left-color: gray; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; margin-left: 0.5in; margin-right: 0.5in; &quot;&gt; &lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; text-indent: -100em; overflow-x: hidden; overflow-y: hidden; background-image: url(http://www.vogella.de/img/icons/info.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; height: 36px; width: 36px; border-top-width: 0px; border-top-style: initial; border-top-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-position: initial initial; background-repeat: no-repeat no-repeat; &quot;&gt; Tip&lt;/h3&gt;If you have not defined any breakpoints this will run your program as normal. To debug the program you need to define breakpoints.&lt;/div&gt;&lt;p&gt;If you start the debugger the first time Eclipse will asked you if you want to switch to the debug perspective. Answer &amp;quot;yes&amp;quot;, you should then see a perspective similar to the following.&lt;/p&gt; &lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/debugstart20.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;p&gt;You can use F5 / F6, F7 and F8 to step through your coding.&lt;/p&gt;&lt;div class=&quot;table&quot;&gt;&lt;a name=&quot;N100C7&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;&lt;p class=&quot;title&quot;&gt;&lt;b&gt;Table 1. Debugging Key bindings&lt;/b&gt;&lt;/p&gt;&lt;div class=&quot;table-contents&quot;&gt; &lt;table summary=&quot;Debugging Key bindings&quot; border=&quot;1&quot;&gt;&lt;colgroup&gt;&lt;col align=&quot;left&quot;&gt;&lt;col align=&quot;left&quot;&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; padding-left: 5px; padding-right: 4px; padding-top: 4px; vertical-align: top; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(239, 239, 239); font-size: small; background-position: initial initial; background-repeat: initial initial; &quot; align=&quot;left&quot;&gt; Command&lt;/th&gt;&lt;th style=&quot;border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; padding-left: 5px; padding-right: 4px; padding-top: 4px; vertical-align: top; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(239, 239, 239); font-size: small; background-position: initial initial; background-repeat: initial initial; &quot; align=&quot;left&quot;&gt; Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt;F5&lt;/td&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt; Goes to the next step in your program. If the next step is a method / function this command will jump into the associated code.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt; F6&lt;/td&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt;F6 will step over the call, e.g. it will call a method / function without entering the associated code.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt;F7&lt;/td&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt; F7 will go to the caller of the method/ function. So this will leave the current code and go to the calling code.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt; F8&lt;/td&gt;&lt;td style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; vertical-align: top; font-size: small; &quot; align=&quot;left&quot;&gt;Use F8 to go to the next breakpoint. If no further breakpoint is encountered then the program will normally run.&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;br class=&quot;table-break&quot;&gt;&lt;p&gt;You can of course use the ui to debug. The following displays the keybindings for the debug buttons.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/debugstart30.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;usedebug_stack&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;3.3. Stack&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;The current stack is displayed in the &amp;quot;Debug&amp;quot; view.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/stack10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class=&quot;sect2&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h3 class=&quot;title&quot; style=&quot;font-size: 14px; font-weight: bold; &quot;&gt;&lt;a name=&quot;usedebug_variables&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;3.4. Variables&lt;/h3&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;p&gt;The view &amp;quot;Variables&amp;quot; displays fields and local variables from the current stack.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/variables10.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;p&gt;Use the menu to display static variables.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/variables20.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;p&gt;Via the menu you can also customize the displayed columns, e.g. you can show the acutual and the declared type.&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/variables30.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;p&gt;Another nice feature is the the &amp;quot;New Detail Formater&amp;quot; in which you can define how a variable is displayed. For example the toString method in our counter shows something meaningless, e.g. &amp;quot;de.vogella.debug.first.Counter@587c94&amp;quot;. Use right mouse click on the variable -&amp;gt; &amp;quot;New Details Formater&amp;quot;&lt;/p&gt; &lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/variables40.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;p&gt;Maintain the following code to get the output &amp;quot;0&amp;quot; (or whatever is field result holds at this point).&lt;/p&gt;&lt;div class=&quot;mediaobject&quot;&gt;&lt;img src=&quot;http://www.vogella.de/articles/EclipseDebugging/images/variables50.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; &quot;&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;sect1&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;titlepage&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;h2 class=&quot;title&quot; style=&quot;background-color: rgb(229, 236, 249); border-top-width: 1px; border-top-style: solid; border-top-color: rgb(51, 102, 204); font-size: 17px; font-weight: bold; padding-top: 1px; padding-right: 3px; padding-bottom: 1px; padding-left: 3px; position: relative; clear: both; &quot;&gt; &lt;a name=&quot;advanced&quot; style=&quot;color: rgb(0, 0, 204); &quot;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/439530025582763104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/439530025582763104' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/439530025582763104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/439530025582763104'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/debug.html' title='Debug'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-313243613136829821</id><published>2011-04-18T06:08:00.001-07:00</published><updated>2011-04-18T06:08:22.244-07:00</updated><title type='text'>Sending Email From Your Application Using Java Mail</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; &quot;&gt;&lt;p&gt; Now a Day&amp;#39;s informing the Clients about the successful updation of data or sending other automated information form your Java Programs, either from your Servlets or from your Applications has become a requirement, more than a feature. Here we show how to use the Java Mail API to send a Mail. To Test Program all you need to have is a SMTP address (Which your ISP Provides). &lt;/p&gt; &lt;p&gt;Before Using this Program, you need to have Javasoft&amp;#39;s JavaMail class files which can be downloaded from here&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.javasoft.com/products/javamail/index.html&quot; style=&quot;color: rgb(0, 0, 128); background-color: transparent; text-decoration: underline; &quot;&gt;http://www.javasoft.com/products/javamail/index.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;You will also need the JavaBeans&lt;sup&gt;TM&lt;/sup&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;Activation Framework extension or JAF (javax.activation). It is available at&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.javasoft.com/beans/glasgow/jaf.html&quot; style=&quot;color: rgb(0, 0, 128); background-color: transparent; text-decoration: underline; &quot;&gt;http://java.sun.com/beans/glasgow/jaf.html&lt;/a&gt;.&lt;/p&gt; &lt;table border=&quot;1&quot; width=&quot;642&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;code&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.8em; &quot; bgcolor=&quot;#FFFFEC&quot; width=&quot;632&quot;&gt;import javax.mail.*;&lt;br&gt;import javax.mail.internet.*;&lt;br&gt; import java.util.*;&lt;p&gt;public void postMail( String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;recipients[ ]&lt;/b&gt;, String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;subject&lt;/b&gt;, String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;message&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;, String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;from&lt;/b&gt;) throws MessagingException&lt;br&gt; {&lt;br&gt;    boolean debug = false;&lt;br&gt;&lt;br&gt;    &lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;font color=&quot;#FF0000&quot;&gt;//Set the host smtp address&lt;/font&gt;&lt;br&gt;     Properties props = new Properties();&lt;br&gt;     props.put(&amp;quot;mail.smtp.host&amp;quot;, &amp;quot;&lt;b&gt;&lt;a href=&quot;http://smtp.jcom.net&quot;&gt;smtp.jcom.net&lt;/a&gt;&lt;/b&gt;&amp;quot;);&lt;br&gt; &lt;br&gt;   &lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;font color=&quot;#FF0000&quot;&gt;// create some properties and get the default Session&lt;/font&gt;&lt;br&gt;    Session session = Session.getDefaultInstance(props, null);&lt;br&gt;    session.setDebug(debug);&lt;br&gt; &lt;br&gt;   &lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;font color=&quot;#FF0000&quot;&gt;// create a message&lt;/font&gt;&lt;br&gt;    Message msg = new MimeMessage(session);&lt;br&gt;&lt;br&gt;   &lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;font color=&quot;#FF0000&quot;&gt;// set the from and to address&lt;/font&gt;&lt;br&gt;     InternetAddress addressFrom = new InternetAddress(from);&lt;br&gt;    msg.setFrom(addressFrom);&lt;br&gt;&lt;br&gt;    InternetAddress[] addressTo = new InternetAddress[recipients.length]; &lt;br&gt;    for (int i = 0; i &amp;lt; recipients.length; i++)&lt;br&gt;     {&lt;br&gt;        addressTo[i] = new InternetAddress(recipients[i]);&lt;br&gt;    }&lt;br&gt;    msg.setRecipients(&lt;a href=&quot;http://Message.RecipientType.TO&quot;&gt;Message.RecipientType.TO&lt;/a&gt;, addressTo);&lt;br&gt;   &lt;/p&gt;&lt;p&gt;   &lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;font color=&quot;#FF0000&quot;&gt;// Optional : You can also set your custom headers in the Email if you Want&lt;/font&gt;&lt;br&gt;     msg.addHeader(&amp;quot;MyHeaderName&amp;quot;, &amp;quot;myHeaderValue&amp;quot;);&lt;/p&gt;&lt;p&gt;   &lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;font color=&quot;#FF0000&quot;&gt;// Setting the Subject and Content Type&lt;/font&gt;&lt;br&gt;    msg.setSubject(subject);&lt;br&gt;     msg.setContent(message, &amp;quot;text/plain&amp;quot;);&lt;br&gt;    Transport.send(msg);&lt;br&gt;}&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;To Send a Email, from your Program, just call the above method, With the following parameters,&lt;/p&gt;&lt;p&gt;String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;to -- Email Address of the Recipient&lt;/b&gt;&lt;/p&gt; &lt;p&gt;String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;subject  -- Email Subject&lt;/b&gt;&lt;/p&gt;&lt;p&gt;String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;message&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;-- Content or Body of the Message&lt;/b&gt;&lt;/p&gt; &lt;p&gt;String&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;from -- Your (Senders) Email Address&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://smtp.jcom.net&quot;&gt;smtp.jcom.net&lt;/a&gt; -- Replace this with your ISP&amp;#39;s SMTP address.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;That&amp;#39;s it, you are all set to send a Email.&lt;/p&gt; &lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/313243613136829821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/313243613136829821' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/313243613136829821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/313243613136829821'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/sending-email-from-your-application.html' title='Sending Email From Your Application Using Java Mail'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-5154804212607215873</id><published>2011-04-18T06:07:00.003-07:00</published><updated>2011-04-18T06:07:51.675-07:00</updated><title type='text'>Deploying Wireless Java Applications</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, FreeSans, Luxi-sans, &amp;#39;Nimbus Sans L&amp;#39;, sans-serif; font-size: 12px; &quot;&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt; Developers usually build, test, and evaluate an application on a platform similar to the one on which it will be deployed and run. Development of wireless Java applications is more challenging because they typically are developed on one platform (such as Solaris or MS Windows) but deployed on a totally different one (such as a cell phone or PDA). One consequence is that, while emulators enable developers to do some of their testing on the development platform, ultimately they must test and evaluate the application in the very different environment of a live wireless network.&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;The aim of this article is to show you the different ways you can download local and network applications to J2ME-enabled devices, for both testing and final deployment. After a brief review of wireless Java applications and their development life-cycle, the article shows you how to:&lt;/p&gt; &lt;ul style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt;Deploy wireless applications remotely&lt;/li&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt; Download local and remotely deployed applications&lt;/li&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt;Download applications over the air&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-size: 15px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt; Wireless Java Applications&lt;/h3&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Wireless Java applications fall into two broad categories:&lt;/p&gt;&lt;ul style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt; &lt;i&gt;Local applications&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;(also called&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;i&gt;stand-alone applications&lt;/i&gt;) perform all their operations on a handheld wireless device and need no access to external data sources through a wireless network. Examples include calculators and single-player games.&lt;/li&gt; &lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt;&lt;i&gt;Network applications&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;consist of some components running on a wireless device and others running on a network, and thus depend on access to external resources. An example would be an email application, with a client residing on a wireless phone that interacts with a Simple Mail Transfer Protocol (SMTP) server to send messages.&lt;/li&gt; &lt;/ul&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Although these two types of applications are different, they are deployed in the same way. The big difference shows up later: Local applications are easier to test than network applications. For example, a calculator application can run on a wireless phone even when it is not connected to any network, but an email client won&amp;#39;t work without a connection to the SMTP server that actually transmits the messages.&lt;/p&gt; &lt;h3 style=&quot;font-size: 15px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt;Wireless Java Applications Development Lifecycle&lt;/h3&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;The development life-cycle of MIDlets and other wireless Java applications comprises three steps:&lt;/p&gt;&lt;ol style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt; &lt;i&gt;Write the application.&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;Use your favorite&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://developers.sun.com/mobility/allsoftware/#midpdev&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;wireless application development environment and tools&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;to develop the application. My favorite is the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://java.sun.com/products/j2mewtoolkit/&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;J2ME Wireless Toolkit&lt;/a&gt;. It has a simple and intuitive user interface that makes it easy to start developing wireless applications. More importantly, it includes several emulators for testing your applications. (Some of what follows will assume you use this toolkit too. If you use another development environment, you&amp;#39;ll have to adapt what you read here to that environment.) &lt;/li&gt; &lt;li style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;i&gt;Test the application in an emulation environment.&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;Once the application compiles nicely, the best place to begin testing it is an emulator. The J2ME Wireless Toolkit comes with several, including Motorola i85s, PalmOS device, and RIM Blackberry. It is important to note, however, that these emulators do not simulate perfectly all of the features of the corresponding devices. They are merely skins with the appropriate dimensions, so the following step is crucial.&lt;br&gt; &lt;/li&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;i&gt;Download the application to a physical device and test it.&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;Once you are happy with the application&amp;#39;s performance on one or more emulators, download it to a real device and test it there. If it&amp;#39;s a network application, test it on a live wireless network to ensure that its performance is acceptable.&lt;/li&gt; &lt;/ol&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;This article&amp;#39;s focus is on that last step: deploying and testing the application on a physical device.&lt;/p&gt;&lt;h3 style=&quot;font-size: 15px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt; Deploying and Running Remote Applications&lt;/h3&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;The J2ME Wireless Toolkit enables you to run your local wireless application from within the development environment; the JAD and JAR files are available on your own system (if you&amp;#39;re using the J2ME Wireless Toolkit, in&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;&amp;lt;toolkit&amp;gt;/apps/YourProject/bin&lt;/code&gt;). If you wish to market your wireless applications, however, you need to deploy them where users from all over the world can access them.&lt;/p&gt; &lt;h4 style=&quot;font-size: 14px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt;Remote Deployment&lt;/h4&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;To deploy your wireless applications remotely:&lt;/p&gt;&lt;ol style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;Upload your application files (JAD and JAR) to a remote web server. If your project is named&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;games&lt;/code&gt;, for instance, upload the files:&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;games.jad&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;games.jar&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;from the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;bin&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;directory of your project home (for example,&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;&amp;lt;toolkit&amp;gt;/apps/games/bin&lt;/code&gt;). Note that the two files must end up in the same directory on the server.&lt;br&gt; &lt;/li&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;Reconfigure the web server so that it recognizes JAD and JAR files:&lt;ul style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt; For the JAD file type, set the file extension to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;.jad&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and the MIME type to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;text/vnd.sun.j2me.app-descriptor&lt;/code&gt;.&lt;/li&gt; &lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt;For the JAR file type, set the file extension to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;.jar&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;and the MIME type to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;application/java-archive&lt;/code&gt;.&lt;/li&gt; &lt;/ul&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;How you configure the web server depends on which one you&amp;#39;re using. For example, if you&amp;#39;re using Tomcat, make sure your&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;web.xml&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;file includes the following lines:&lt;/p&gt; &lt;table class=&quot;grey4&quot; style=&quot;background-color: rgb(231, 231, 231); &quot; border=&quot;0&quot; cellpadding=&quot;10&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); font-size: 11px; &quot;&gt; &amp;lt;mime-mapping&amp;gt;    &amp;lt;extension&amp;gt;jad&amp;lt;/extension&amp;gt;    &amp;lt;mime-type&amp;gt;text/vnd.sun.j2me.app-descriptor&amp;lt;/mime-type&amp;gt; &amp;lt;/mime-mapping&amp;gt; &amp;lt;mime-mapping&amp;gt;    &amp;lt;extension&amp;gt;jar&amp;lt;/extension&amp;gt;    &amp;lt;mime-type&amp;gt;application/java-archive&amp;lt;/mime-type&amp;gt; &amp;lt;/mime-mapping&amp;gt; &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class=&quot;sp20&quot; style=&quot;font-size: 19px !important; &quot;&gt;&lt;/span&gt;&lt;br&gt;&lt;/li&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;Change your JAD file&amp;#39;s&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;MIDlet-Jar-URL&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;property to specify the URL of your JAR file. For example, in the copy of&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;games.jad&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;you uploaded to the server, change...&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt; &lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;MIDlet-Jar-URL: games.jar&lt;/code&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;...to...&lt;/p&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt; &lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;MIDlet-Jar-URL: http://YourWebServerAddress:port/pathTo/games.jar&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h4 style=&quot;font-size: 14px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt; Running Remotely Deployed Applications&lt;/h4&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;To see whether your application deployed correctly, open an ordinary web browser and enter the JAD file&amp;#39;s URL. The J2ME Wireless Toolkit&amp;#39;s default emulator should appear and the remotely deployed application should run in it.&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;J2ME-enabled devices (the Motorola/Nextel i85s, for example) include a Java Application Manager (JAM) responsible for downloading, installing, and configuring applications. The J2ME Wireless Toolkit includes a sample JAM you can run in the default emulator. To see how the user will download and manage your application, open a command prompt, change the current directory to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;&amp;lt;toolkit&amp;gt;/bin&lt;/code&gt;, and enter the command:&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;    emulator -Xjam&lt;/code&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt; The emulator appears and you see the JAM&amp;#39;s main screen. In version 1.0.4 of the toolkit, the main screen looks like this:&lt;/p&gt;&lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig1.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 1: The J2ME Wireless Toolkit Java Application Manager&amp;#39;s Main Screen&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Select the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;Install&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;soft button and you will be prompted for the application&amp;#39;s URL, as shown in Figure 2. Enter the URL of a web page that contains a hyperlink to the application&amp;#39;s JAD file.&lt;/p&gt; &lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig2.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 2: Entering the URL for the Application&amp;#39;s JAD File&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Entering a long URL into a wireless phone is inconvenient. A faster and easier way to get started is to use a command in this form:&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;    emulator -Xjam:install=http://yourWebServerAddress:port/yourApp.jad&lt;/code&gt;&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Without further entry, the JAM downloads the JAR file specified in the JAD file and installs the application. The next time you start the emulator, simply select the JAM&amp;#39;s&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;Menu&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;button, then use the menu to run the application, remove it, or perform the other functions shown in Figure 3:&lt;/p&gt; &lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig3.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 3: The JAM&amp;#39;s Main Menu&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;It is important to note that this syntax allows you to install only one MIDlet at a time. Entering a URL allows you to view a web page that may contain several MIDlets you can choose from. As an example, consider the following HTML file (&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;midlets.html&lt;/code&gt;) that contains links to three JAD files:&lt;/p&gt; &lt;table class=&quot;grey4&quot; style=&quot;background-color: rgb(231, 231, 231); &quot; border=&quot;0&quot; cellpadding=&quot;10&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); font-size: 11px; &quot;&gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;title&amp;gt;Midlets&amp;lt;/title&amp;gt; &amp;lt;/head&amp;gt;  &amp;lt;body&amp;gt;  Download midlets: &amp;lt;p&amp;gt; &amp;lt;a href=&amp;quot;&lt;a href=&quot;http://127.0.0.1:8080/games.jad&quot;&gt;http://127.0.0.1:8080/games.jad&lt;/a&gt;&amp;quot;&amp;gt;Games.jad&amp;lt;/a&amp;gt; &amp;lt;p&amp;gt; &amp;lt;a href=&amp;quot;/mobility/midp/articles/deploy/calc.jad&amp;quot;&amp;gt;Calc.jad&amp;lt;/a&amp;gt; &amp;lt;p&amp;gt; &amp;lt;a href=&amp;quot;/mobility/midp/articles/deploy/browser.jad&amp;quot;&amp;gt;Browser.jad&amp;lt;/a&amp;gt;  Thank you.  &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt; &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class=&quot;sp20&quot; style=&quot;font-size: 19px !important; &quot;&gt;&lt;/span&gt;&lt;br&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;It is important to note that the hyperlinks point to the application&amp;#39;s JAD file. Now, enter the URL into the install window as shown in Figure 4. (The IP address&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;127.0.0.1&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;is equivalent to&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;localhost&lt;/code&gt;.)&lt;/p&gt; &lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig4.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 4: Entering a URL in the Install Window&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;The JAM reads the HTML doccument (&lt;code style=&quot;font-family: Monaco, Courier, &amp;#39;Courier New&amp;#39;, monospace; color: rgb(68, 68, 68); &quot;&gt;midlets.html&lt;/code&gt;), parses the hyperlinks, and displays a list of MIDlets you can download:&lt;/p&gt; &lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig5.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 5: Links to Downloadable MIDlets&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Now you can select a MIDlet to download. The JAM reads the JAD file to discover whether the device is capable of handling the application. If so, it downloads and installs the JAR file specified in the JAD file. Once the games MIDlet is downloaded and installed, you will see a display similar to Figure 6. Note that games.jad is the MIDlet suite that comes with the J2ME Wireless Toolkit.&lt;/p&gt; &lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig6.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 6: The MIDlet Suite of Games Downloaded and Installed&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;The JAM is smart enough to notify you if you try to install a MIDlet that&amp;#39;s already on your device, as in FIgure 7. It will, however, allow you to download an updated version of the MIDlet.&lt;/p&gt; &lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig7.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 7: Warning That MIDlet Is Already Installed&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;h3 style=&quot;font-size: 15px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt; Deploying and Running Applications on Physical Devices&lt;/h3&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Deploying and running applications in an emulation environment is a very good way to test the logic and flow of your application generally, but you won&amp;#39;t be certain it will satisfy users until you test it on a real physical device connected to a wireless network. Your application&amp;#39;s performance may be stunning in the emulator, which has all the processing power and memory of your desktop machine at its command, but will it perform well on the handheld device, with its limited memory and processing power, low bandwidth, and other constraints?&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;To perform realistic tests you need a J2ME-enabled physical device, and a data cable to connect it to your desktop. For this article&lt;/p&gt;&lt;div class=&quot;contentdivider&quot; style=&quot;padding-top: 3px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; &quot;&gt; &lt;table class=&quot;grey4&quot; style=&quot;background-color: rgb(231, 231, 231); &quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=&quot;http://developers.sun.com/im/a.gif&quot; alt=&quot; &quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; height: 2px; &quot; border=&quot;0&quot; height=&quot;4&quot; width=&quot;1&quot;&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;I used a Motorola/Nextel i85s cell phone, available from&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://nextelonline.nextel.com/NASApp/onlinestore/Action/PhoneLanding?initstate=true&amp;amp;redirect=false&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;Nextel&lt;/a&gt;, which offers several models and rate plans.&lt;h4 style=&quot;font-size: 14px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt; Deploying Local Applications&lt;/h4&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;If you have a Motorola J2ME-enabled phone, you can download stand-alone applications using the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://idenphones.motorola.com/iden/developer/developer_tools_jal.jsp&quot; style=&quot;text-decoration: underline; color: rgb(0, 0, 0); &quot;&gt;Motorola Java Application Loader Lite (JAL Lite)&lt;/a&gt;. Note that JAL Lite limits filename lengths to 16 characters, and expects an application&amp;#39;s JAD and JAR files to be in the same directory.&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Connect the phone to your desktop and start JAL Lite on your desktop. You&amp;#39;ll see a window like the one in Figure 8:&lt;/p&gt;&lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig8.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 8: Motorola JAL Lite&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;The application displays the MIDlets already installed on the device. To install a new application, click on the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;Connect&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;button, then the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;Download&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;button. The application loader lets you browse your hard disk and select a JAD file. As soon as you do, it begins downloading the application and displays a progress indicator as shown in Figure 9:&lt;/p&gt; &lt;center&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig9.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 9: JAL Lite Downloading an Application to the Phone&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Once the download is complete, click on the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;b&gt;Disconnect&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;button, and disconnect the phone from the data cable. When you browse through the Java applications available on the phone, you should see the application you just downloaded. Select it and you will be asked if you wish to install it. If you answer yes, the application will be installed and you can start using it. The application remains on the phone until you explicitly remove it.&lt;/p&gt; &lt;h4 style=&quot;font-size: 14px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt;Buying and Deploying Remote Applications&lt;/h4&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;You can use JAL Lite and the data cable to download local applications to a wireless phone from your desktop, including freely available applications you first download to your desktop using HTTP or FTP. Many useful applications are accessible only if you use special tools, however, usually because developers and wireless carriers wish to charge people for downloading them. There are two ways to download remotely deployed applications:&lt;/p&gt; &lt;ul style=&quot;margin-left: 13px; padding-left: 0px; &quot;&gt;&lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt;&lt;i&gt;Download your own remotely deployed applications&lt;/i&gt;: You can use the Motorola iDEN Java Application Loader to download local&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;i&gt;and&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;remotely deployed applications, much as you use JAL Lite to download local applications. Motorola&amp;#39;s iDEN web site provides detailed information on&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://idenphones.motorola.com/iden/developer/developer_iupdate_app.jsp&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;how to become a member of iDEN&amp;#39;s Developer Program and start downloading&lt;/a&gt;.&lt;/li&gt; &lt;li style=&quot;margin-left: 13px; padding-left: 0px; list-style-image: url(http://developers.sun.com/im/ul_bullet.gif); &quot;&gt;&lt;i&gt;Buy and download others&amp;#39; applications&lt;/i&gt;: Motorola and Nextel have a large database of wireless applications available for download. Some are free. Check out&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://iden.motorola.com/iupdatephone/en/j2me_app.cfm&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;iDEN Update&lt;/a&gt;, a web-based service with a client-side download application – itself a free downloadable application! – that enables you to download new features, applications, and enhancements. You can browse the site, select features and applications you&amp;#39;d like, and update your phone over the Internet. You&amp;#39;ll need the iDEN Update client software and an update data cable. A snapshot of the iDEN wireless marketplace appears in Figure 10:&lt;/li&gt; &lt;/ul&gt;&lt;center&gt;&lt;a href=&quot;http://developers.sun.com/mobility/images/deploy_fig10.gif&quot; target=&quot;_blank&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig10_thumb.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 10: Motorola iDEN Update&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt;&lt;a href=&quot;http://developers.sun.com/mobility/images/deploy_fig10.gif&quot; target=&quot;_blank&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;(click for full size)&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;/center&gt; &lt;h3 style=&quot;font-size: 15px; margin-top: 3px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; &quot;&gt;Downloading Applications Over The Air&lt;/h3&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;For some time, wireless portals in Europe such as&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.midletcentral.com/&quot; style=&quot;text-decoration: underline; color: rgb(0, 0, 0); &quot;&gt;Midletcentral&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;have allowed customers to download applications directly to their phones, over the air. Over-the-air provisioning of wireless applications (OTA) is finally available in North America. Nextel customers, for example, can download network-aware wireless applications without an update data cable.&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;OTA is the deployment of wireless Java applications (&lt;i&gt;MIDlet suites&lt;/i&gt;) from the Internet to wireless devices over a wireless network. Users need not connect their devices to the desktop with a data cable or visit a service center to install or upgrade software. See&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://java.sun.com/products/midp/OTAProvisioning-1.0.pdf&quot; style=&quot;text-decoration: underline; color: rgb(0, 0, 0); &quot;&gt;Over The Air User Initiated Provisioning Recommended Practice for the Mobile Information Device Profile&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;for details.&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;To take advantage of OTA, you must equip your handheld device with a mechanism to discover MIDlet suites available for download, using the device&amp;#39;s browser (such as a WAP browser) or a resident application written specifically to identify downloadable MIDlet suites. &lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;The process of downloading MIDlets over the air is illustrated in Figure 11.&lt;/p&gt;&lt;center&gt;&lt;a href=&quot;http://developers.sun.com/mobility/images/deploy_fig11.gif&quot; target=&quot;_blank&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;img src=&quot;http://developers.sun.com/mobility/images/deploy_fig11_thumb.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;br&gt; &lt;span class=&quot;body&quot; style=&quot;color: rgb(0, 0, 0); font-size: 13px; &quot;&gt;&lt;i&gt;Figure 11: Over-the-Air Provisioning of MIDlets&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://developers.sun.com/mobility/images/deploy_fig11.gif&quot; target=&quot;_blank&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;br&gt; (click for full size)&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;/center&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;&lt;b&gt;Conclusion&lt;/b&gt;:&lt;/p&gt;&lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;Many&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://developers.sun.com/mobility/device&quot; style=&quot;text-decoration: underline; color: rgb(0, 0, 0); &quot;&gt;Java-enabled wireless devices&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;are already out there, and the necessary wireless infrastructure is in place to begin deploying wireless applications. This article discussed several ways to deploy and test local and remote wireless Java applications.&lt;/p&gt; &lt;p style=&quot;margin-top: 3px; margin-bottom: 17px; &quot;&gt;To succeed in the wireless market, you need to develop relationships with other developers, device manufacturers, content developers, and wireless carriers. Several device manufacturers (such as Nokia) and wireless carriers (such as Nextel) offer developer programs that can help you market your dazzling wireless Java application.&lt;/p&gt; &lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/5154804212607215873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/5154804212607215873' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5154804212607215873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5154804212607215873'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/deploying-wireless-java-applications.html' title='Deploying Wireless Java Applications'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-2437569252338202097</id><published>2011-04-18T06:07:00.001-07:00</published><updated>2011-04-18T06:07:02.934-07:00</updated><title type='text'>Server load balancing architectures, Part 2: Application-level load balancing</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;#39;Times New Roman&amp;#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; text-align: left; &quot;&gt;&lt;p class=&quot;first&quot; style=&quot;margin-top: 10px; margin-bottom: 15px; font-size: 12px; line-height: 20px; padding-bottom: 8px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: rgb(224, 224, 224); &quot;&gt; The transport-level server load balancing architectures described in the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;first half of this article&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;are more than adequate for many Web sites, but more complex and dynamic sites can&amp;#39;t depend on them. Applications that rely on cache or session data must be able to handle a sequence of requests from the same client accurately and efficiently, without failing. In this follow up to hisintroduction to server load balancing, Gregor Roth discusses various application-level load balancing architectures, helping you decide which one will best meet the business requirements of your Web site.&lt;/p&gt; &lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;The&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;first half&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;of this article describes transport-level server load balancing solutions, such as TCP/IP-based load balancers, and analyzes their benefits and disadvantages. Load balancing on the TCP/IP level spreads incoming TCP connections over the real servers in a server farm. It is sufficient in most cases, especially for static Web sites. However, support for dynamic Web sites often requires higher-level load balancing techniques. For instance, if the server-side application must deal with caching or application session data, effective support for client affinity becomes an important consideration. Here in Part 2, I&amp;#39;ll discuss techniques for implementing server load balancing at the application level to address the needs of many dynamic Web sites.&lt;/p&gt; &lt;h2 style=&quot;font-size: 14px; line-height: normal; font-weight: bold; &quot;&gt;Intermediate server load balancers&lt;/h2&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;In contrast to low-level load balancing solutions, application-level server load balancing operates with application knowledge. One popular load-balancing architecture, shown in Figure 1, includes both an application-level load balancer and a transport-level load balancer.&lt;/p&gt; &lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;&lt;a href=&quot;http://www.javaworld.com/javaworld/jw-10-2008/images/load-balancing2-fig1.gif&quot; style=&quot;text-decoration: none; color: rgb(3, 90, 135); &quot;&gt;&lt;img alt=&quot;Load balancing on transport and application levels&quot; src=&quot;http://www.javaworld.com/javaworld/jw-10-2008/images/load-balancing2-fig1_thumb.gif&quot; style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; &quot; height=&quot;155&quot; width=&quot;300&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;h4 style=&quot;font-size: 11px; line-height: normal; font-family: Arial, Helvetica, sans-serif; font-weight: bold; &quot;&gt;Figure 1. Load balancing on transport and application levels (click to enlarge)&lt;/h4&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt; The application-level load balancer appears to the transport-level load balancer as a normal server. Incoming TCP connections are forwarded to the application-level load balancer. When it retrieves an application-level request, it determines the target server on the basis of the application-level data and forwards the request to that server.&lt;/p&gt; &lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;Listing 1 shows an application-level load balancer that uses a HTTP request parameter to decide which back-end server to use. In contrast to the transport-level load balancer, it makes the routing decision based on an application-level HTTP request, and the unit of forwarding is a HTTP request. Similarly to the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;memcached&lt;/code&gt;approach I discussed in Part 1, this solution uses a &amp;quot;hash key&amp;quot;-based partitioning algorithm to determine the server to use. Often, attributes such as user ID or session ID are used as the partitioning key. As a result, the same server instance always handles the same user. The user&amp;#39;s client is&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;i&gt;affine&lt;/i&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;or &amp;quot;sticky&amp;quot; to the server. For this reason the server can make use of a local&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;HttpRequest&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;cache I discussed in Part 1.&lt;/p&gt; &lt;h4 style=&quot;font-size: 11px; line-height: normal; font-family: Arial, Helvetica, sans-serif; font-weight: bold; &quot;&gt;Listing 1. Intermediate application-level load balancer&lt;/h4&gt;&lt;div id=&quot;codewrap&quot; style=&quot;overflow-x: auto; overflow-y: auto; width: auto; height: auto; margin-top: -3px; margin-right: 0px; margin-bottom: 25px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 102, 102); border-right-color: rgb(102, 102, 102); border-bottom-color: rgb(102, 102, 102); border-left-color: rgb(102, 102, 102); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(241, 242, 243); background-position: initial initial; background-repeat: initial initial; &quot;&gt; &lt;div id=&quot;codewrap17&quot;&gt;&lt;pre style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;class LoadBalancerHandler implements IHttpRequestHandler, ILifeCycle {    private final List&amp;lt;InetSocketAddress&amp;gt; servers = new ArrayList&amp;lt;InetSocketAddress&amp;gt;();    private HttpClient httpClient;     /*     * this class does not implement server monitoring or healthiness checks     */     public LoadBalancerHandler(InetSocketAddress... srvs) {       servers.addAll(Arrays.asList(srvs));    }    public void onInit() {       httpClient = new HttpClient();       httpClient.setAutoHandleCookies(false); }      public void onDestroy() throws IOException {       httpClient.close();    }     public void onRequest(final IHttpExchange exchange) throws IOException {       IHttpRequest request = exchange.getRequest();        // determine the business server based on the id&amp;#39;s hashcode       Integer customerId = request.getRequiredIntParameter(&amp;quot;id&amp;quot;);       int idx = customerId.hashCode() % servers.size();       if (idx &amp;lt; 0) {          idx *= -1;       }        // retrieve the business server address and update the Request-URL of the request       InetSocketAddress server = servers.get(idx);       URL url = request.getRequestUrl();       URL newUrl = new URL(url.getProtocol(), server.getHostName(), server.getPort(), url.getFile());       request.setRequestUrl(newUrl);        // proxy header handling (remove hop-by-hop headers, ...)       // ...         // create a response handler to forward the response to the caller       IHttpResponseHandler respHdl = new IHttpResponseHandler() {           @Execution(Execution.NONTHREADED)          public void onResponse(IHttpResponse response) throws IOException {             exchange.send(response);          }           @Execution(Execution.NONTHREADED)          public void onException(IOException ioe) throws IOException {             exchange.sendError(ioe);          }       };        // forward the request in a asynchronous way by passing over the response handler       httpClient.send(request, respHdl);    } }    class LoadBalancer {     public static void main(String[] args) throws Exception {       InetSocketAddress[] srvs = new InetSocketAddress[] { new InetSocketAddress(&amp;quot;srv1&amp;quot;, 8030), new InetSocketAddress(&amp;quot;srv2&amp;quot;, 8030)};       HttpServer loadBalancer = new HttpServer(8080, new LoadBalancerHandler(srvs));       loadBalancer.run();    } }&lt;/code&gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;In Listing 1, the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;LoadBalancerHandler&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;reads the HTTP&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;id&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;request parameter and computes the hash code. Going beyond this simple example, in some cases load balancers must read (a part of) the HTTP body to retrieve the required balancing algorithm information. The request is forwarded based on the result of the modulo operation. This is done by the&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;HttpClient&lt;/code&gt;object. This&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;HttpClient&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;also pools and reuses (persistent) connections to the servers for performance reasons. The response is handled in an asynchronous way through the use of an&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;HttpResponseHandler&lt;/code&gt;. This non-blocking, asynchronous approach minimizes the load balancer&amp;#39;s system requirements. For instance, no outstanding thread is required during a call. For a more detailed explanation of asynchronous, non-blocking HTTP programming, read my article &amp;quot;&lt;a href=&quot;http://www.javaworld.com/javaworld/jw-10-2008/jw-10-load-balancing-2.html#resources&quot; style=&quot;text-decoration: none; color: rgb(3, 90, 135); &quot;&gt;Asynchronous HTTP and Comet architectures&lt;/a&gt;.&amp;quot;&lt;/p&gt; &lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;Another intermediate application-level server load balancing technique is&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;i&gt;cookie injection&lt;/i&gt;. In this case the load balancer checks if the request contains a specific load balancing cookie. If the cookie is not found, a server is selected using a distribution algorithm such as round-robin. A load balancing session cookie is added to the response before the response is sent. When the browser receives the session cookie, the cookie is stored in temporary memory and is not retained after the browser is closed. The browser adds the cookie to all subsequent requests in that session, which are sent to the load balancer. By storing the server slot as cookie value, the load balancer can determine the server that is responsible for this request (in this browser session). Listing 2 implements a load balancer based on cookie injection.&lt;/p&gt; &lt;h4 style=&quot;font-size: 11px; line-height: normal; font-family: Arial, Helvetica, sans-serif; font-weight: bold; &quot;&gt;Listing 2. Cookie-injection based application-level load balancer&lt;/h4&gt;&lt;div id=&quot;codewrap&quot; style=&quot;overflow-x: auto; overflow-y: auto; width: auto; height: auto; margin-top: -3px; margin-right: 0px; margin-bottom: 25px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 102, 102); border-right-color: rgb(102, 102, 102); border-bottom-color: rgb(102, 102, 102); border-left-color: rgb(102, 102, 102); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(241, 242, 243); background-position: initial initial; background-repeat: initial initial; &quot;&gt; &lt;div id=&quot;codewrap29&quot;&gt;&lt;pre style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; &quot;&gt;&lt;code style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: small; &quot;&gt;class CookieBasedLoadBalancerHandler implements IHttpRequestHandler, ILifeCycle {    private final List&amp;lt;InetSocketAddress&amp;gt; servers = new ArrayList&amp;lt;InetSocketAddress&amp;gt;();    private int serverIdx = 0;    private HttpClient httpClient;     /*     * this class does not implement server monitoring or healthiness checks     */     public CookieBasedLoadBalancerHandler(InetSocketAddress... realServers) {       servers.addAll(Arrays.asList(realServers));    }     public void onInit() {       httpClient = new HttpClient();       httpClient.setAutoHandleCookies(false); }     public void onDestroy() throws IOException {       httpClient.close();    }     public void onRequest(final IHttpExchange exchange) throws IOException {       IHttpRequest request = exchange.getRequest();         IHttpResponseHandler respHdl = null;       InetSocketAddress serverAddr = null;        // check if the request contains the LB_SLOT cookie       cl : for (String cookieHeader : request.getHeaderList(&amp;quot;Cookie&amp;quot;)) {          for (String cookie : cookieHeader.split(&amp;quot;;&amp;quot;)) {             String[] kvp = cookie.split(&amp;quot;=&amp;quot;);             if (kvp[0].startsWith(&amp;quot;LB_SLOT&amp;quot;)) {                int slot = Integer.parseInt(kvp[1]);                serverAddr = servers.get(slot);                break cl;             }          }       }        // request does not contains the LB_SLOT -&amp;gt; select a server       if (serverAddr == null) {          final int slot = nextServerSlot();          serverAddr = servers.get(slot);           respHdl = new IHttpResponseHandler() {              @Execution(Execution.NONTHREADED)             public void onResponse(IHttpResponse response) throws IOException {                // set the LB_SLOT cookie                response.setHeader(&amp;quot;Set-Cookie&amp;quot;, &amp;quot;LB_SLOT=&amp;quot; + slot + &amp;quot;;Path=/&amp;quot;);                exchange.send(response);             }              @Execution(Execution.NONTHREADED)             public void onException(IOException ioe) throws IOException {                exchange.sendError(ioe);             }          };        } else {          respHdl = new IHttpResponseHandler() {              @Execution(Execution.NONTHREADED)             public void onResponse(IHttpResponse response) throws IOException {                exchange.send(response);             }              @Execution(Execution.NONTHREADED)             public void onException(IOException ioe) throws IOException {                exchange.sendError(ioe);             }          };       }        // update the Request-URL of the request       URL url = request.getRequestUrl();       URL newUrl = new URL(url.getProtocol(), serverAddr.getHostName(), serverAddr.getPort(), url.getFile());       request.setRequestUrl(newUrl);        // proxy header handling (remove hop-by-hop headers, ...)       // ...        // forward the request       httpClient.send(request, respHdl);    }     // get the next slot by using the using round-robin approach    private synchronized int nextServerSlot() {       serverIdx++;       if (serverIdx &amp;gt;= servers.size()) {          serverIdx = 0;       }       return serverIdx;    } }   class LoadBalancer {     public static void main(String[] args) throws Exception {       InetSocketAddress[] srvs = new InetSocketAddress[] { new InetSocketAddress(&amp;quot;srv1&amp;quot;, 8030), new InetSocketAddress(&amp;quot;srv2&amp;quot;, 8030)};       CookieBasedLoadBalancerHandler hdl = new CookieBasedLoadBalancerHandler(srvs);       HttpServer loadBalancer = new HttpServer(8080, hdl);       loadBalancer.run();    } }&lt;/code&gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;margin-top: 10px; margin-bottom: 10px; font-size: 14px; line-height: 20px; &quot;&gt;Unfortunately, the cookie-injection approach only works if the browser accepts cookies. If the user deactivates cookies, the client loses stickiness.&lt;/p&gt; &lt;/span&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/2437569252338202097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/2437569252338202097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/2437569252338202097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/2437569252338202097'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/server-load-balancing-architectures.html' title='Server load balancing architectures, Part 2: Application-level load balancing'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-3463057629579093896</id><published>2011-04-10T02:03:00.001-07:00</published><updated>2011-04-10T02:03:45.483-07:00</updated><title type='text'>James Gosling riffs at TSSJS keynote</title><content type='html'>ames Gosling gave the keynote address at TheServerSide Java Symposium on Wednesday, touching on topics including Oracle&amp;#39;s stewardship of Java, the importance of Java Virtual Machine (JVM), JDK 7 and cloud computing.&lt;br&gt; &lt;br&gt;On Oracle&amp;#39;s ownership of Java: One of Gosling&amp;#39;s slides read: &amp;quot;No clue what Larry (Ellison) will do. But he won&amp;#39;t shoot himself. I hope.&amp;quot;&lt;br&gt;&lt;br&gt;&amp;quot;It&amp;#39;s in their own self-interest to not be really aggressively stupid,&amp;quot; Gosling said, prompting audience laughter. &amp;quot;But it&amp;#39;s been clear that it&amp;#39;s been something of a learning experience. It&amp;#39;s been clear that they didn&#39;t understand what they bought, what it meant to deal with communities and people and all the arguing and discussion and consensus building that&#39;s involved in communities.&amp;quot;&lt;br&gt; &lt;br&gt;On JVM: Gosling said that in the Java world, what he really cares about is JVM.&lt;br&gt;&lt;br&gt;&amp;quot;That&amp;#39;s what ties it all together,&amp;quot; he said. &amp;quot;It makes all kinds of languages able to coexist.&amp;quot;&lt;br&gt;&lt;br&gt;Gosling added that in the non-JVM world, being able to go back and forth between different languages is much more difficult. But with JVM, it is &amp;quot;remarkably straightforward&amp;quot; to write a piece of your program in Java, in JavaScript and in Ruby.&lt;br&gt; &lt;br&gt;On SOA and REST: &amp;quot;They&amp;#39;ve sedimented down and they&amp;#39;ve become the bedrock that so much stuff rests upon.&amp;quot;&lt;br&gt;&lt;br&gt;But he added that his big problem with SOA and REST today is that &amp;quot;people get service-happy. They start building thousands of services that should be coalesced into fewer services.&amp;quot;&lt;br&gt; &lt;br&gt;On JDK 7: &amp;quot;The Oracle folks have been doing a pretty good job of getting that marching forward. The JDK had been stuck on a bunch of JDP procedural issues.&amp;quot;&lt;br&gt;&lt;br&gt;Also: &amp;quot;They decided they wanted to get things out sooner rather than later, so the feature list isn&amp;#39;t everything we wanted, but it will get there.&amp;quot;&lt;br&gt; &lt;br&gt;On cloud computing: &amp;quot;The word cloud has become really annoying. Every marketer has a new take on it. It will cure cancer. It will find the fountain the youth.&amp;quot;&lt;br&gt;&lt;br&gt;&amp;quot;There are a bunch of interesting things in clouds,&amp;quot; he added. &amp;quot;I am a fan.&amp;quot;&lt;br&gt; &lt;br&gt;&amp;quot;It&amp;#39;s this combination of real management and dynamics that really set clouds apart,&amp;quot; he said.&lt;br&gt;&lt;br&gt;On social media: &amp;quot;I&amp;#39;m about the geekiest guy you could imagine, but all the successful things out there, if you were to ask me about them, I would say they are really stupid. I just don&amp;#39;t get Zynga. I just don&amp;#39;t get FarmVille. I just don&amp;#39;t get it.&amp;quot;&lt;br&gt; &lt;br&gt;But that doesn&amp;#39;t discourage him.&lt;br&gt;&lt;br&gt;&amp;quot;The Web these days - and this is kind of cool - is now the domain of the artists and the social scientists,&amp;quot; he said. &amp;quot;For myself as an engineer, I&amp;#39;m just kind of a plumber in the basement of the place. And yeah, you can get a little depressed about that, but it really is exciting. It opens things up to people who are differently able, who have different skills from me.&amp;quot;&lt;br&gt; &lt;br&gt;SOURCE:&lt;a href=&quot;http://www.theserverside.com/news/2240033442/James-Gosling-riffs-at-TSSJS-keynote&quot;&gt;http://www.theserverside.com/news/2240033442/James-Gosling-riffs-at-TSSJS-keynote&lt;/a&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/3463057629579093896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/3463057629579093896' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3463057629579093896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3463057629579093896'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/james-gosling-riffs-at-tssjs-keynote.html' title='James Gosling riffs at TSSJS keynote'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-3611798996645350367</id><published>2011-04-10T01:58:00.001-07:00</published><updated>2011-04-10T01:58:23.167-07:00</updated><title type='text'>Web Application Testing Tools - Open Source</title><content type='html'>Many organizations are surprised to find that it is more expensive to do testing using tools. In order to gain benefits from testing tools, careful thought must be given for which tests you want to use tools and to the tool being chosen. &lt;br&gt; &lt;br&gt;Anteater is a testing framework designed around Ant, from the Apache Jakarta Project. It is basically a set of Ant tasks for the functional testing of Web sites and Web services (functional testing being: hit a URL and ensure the response meets certain criteria). One can test HTTP parameters, response codes, XPath, regexp, and Relax NG expressions. Anteater also includes HTML reporting (based on junitreport) and a hierarchical grouping system for quickly configuring large test scripts. When a Web request is received, Anteater can check the parameters of the request and send a response accordingly. This makes it useful for testing SOAP and XML applications.&lt;br&gt; &lt;br&gt;The ability to wait for incoming HTTP messages is something unique to Anteater, which makes it especially useful when building tests for applications that use high level SOAP-based communication, like ebXML or BizTalk. Applications written using these protocols usually receive SOAP messages and send back a meaningless response. It is only later that they inform the client, using an HTTP request on the client, about the results of the processing. These are the so-called asynchronous SOAP messages, and are the heart of many high-level protocols based on SOAP or XML messages.&lt;br&gt; &lt;br&gt;Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission, Javascript, basic HTTP authentication, cookies, and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links.&lt;br&gt; &lt;br&gt;jWebUnit is a Java framework which facilitates creation of acceptance tests for Web applications. It provides a high-level API for navigating a Web application combined with a set of assertions to verify the application&amp;#39;s correctness. This includes navigation via links, form entry and submission, validation of table contents, and other typical business Web application features. It utilizes HttpUnit behind the scenes. The simple navigation methods and ready-to-use assertions allow for more rapid test creation than using only JUnit and HttpUnit.&lt;br&gt; &lt;br&gt;Bugkilla is a tool set to create, maintain, execute, and analyze functional system tests of Web applications. Specification and execution of tests is automated for both the Web frontend and business logic layers. One goal is to integrate with existing frameworks and tools (an Eclipse Plugin exists)&lt;br&gt; &lt;br&gt;The Grinder, a Java load testing framework freely available under a BSD-style Open Source license, makes it easy to orchestrate the activities of a test script in many processes across many machines, using a graphical console application. Test scripts make use of client code embodied in Java plugins. Most users of The Grinder do not write plugins themselves; they use one of the supplied plugins. The Grinder comes with a mature plugin for testing HTTP services, as well as a tool which allows HTTP scripts to be automatically recorded.&lt;br&gt; &lt;br&gt;Jameleon is an automated testing tool that separates applications into features and allows those features to be tied together independently, creating test cases. These test cases can then be data-driven and executed against different environments. Jameleon breaks applications into features and allows testing at any level, simply by passing in different data for the same test. Because Jameleon is based on Java and XML, there is no need to learn a proprietary technology.&lt;br&gt; &lt;br&gt;It&amp;#39;s an acceptance testing tool for testing the functionality provided by applications, and currently supports the testing of Web applications. It differs from regular HttpUnit and jWebUnit in that it separates testing of features from the actual test cases themselves. If I understand it correctly, you write the feature tests separately and then script them together into a reusable test case. Incidentally, you can also make these test cases data-driven, which gives an easy way of running specific tests on specific environments.&lt;br&gt; &lt;br&gt;The framework has a plugin architecture, allowing different functional testing tools to be used, and there is a plugin for testing Web applications using HttpUnit/jWebUnit. The test case scripting is done with XML and Jelly.&lt;br&gt; &lt;br&gt;Jameleon combines XDoclet, Ant and Jelly to provide a potentially powerful framework for solid functional testing of your Webapp. It strikes a good balance between scripting and coding, and allows you to set up multiple inputs per test by providing input via CSV files. Along with the flexibility come a complexity and maintenance overhead, but you are getting your Webapp tested for you.&lt;br&gt; &lt;br&gt;LogiTest is the core application in the LogiTest suite. LogiTest is designed to aid in the testing of Web site functionality. It currently supports HTTP and HTTPS protocols, GET and POST methods, multiple document views, custom headers, and more. The LogiTest application provides a simple graphical user interface for creating and playing back tests for testing Internet-based applications.&lt;br&gt; &lt;br&gt;Solex is a set of Eclipse plugins providing non-regression and stress tests of Web application servers. Test scripts are recorded from Internet browsers, thanks to a built-in Web proxy. For some Web applications, a request depends on a previous server&amp;#39;s response. To address such a requirement, Solex introduces the concept of extraction and replacement rules. An extraction rule tied to an HTTP message&amp;#39;s content will bind an extracted value with a variable. A replacement rule will replace any part of an HTTP message with variable content.&lt;br&gt; &lt;br&gt;The tool therefore provides an easy way to extract URL parameters, Header values, or any part of a request or a response, bind their values with variables, and then replace URL parameters, Header values, or any part of a request with the variable content. The user has the ability to add assertions for each response. Once a response has been received, all assertions of this response will be called to ensure that it is valid. If not, the playback process is stopped. Several kinds of rules and assertions are provided. The most complicated ones support regular expressions and XPath.&lt;br&gt; &lt;br&gt;Tclwebtest is a tool for writing automated tests of Web applications in Tcl. It implements some basic HTML parsing functionality to provide comfortable commands for operations on the HTML elements (most importantly forms) of the result pages.&lt;br&gt; &lt;br&gt;TagUnit is a framework through which custom tags can be tested inside the container and in isolation from the pages on which they will ultimately be used. In essence, it&amp;#39;s a tag library for testing tags within JSP pages. This means that it is easy to unit test tags, including the content that they generate and the side effects that they have on the environment, such as the introduction of scripting variables, page context attributes, cookies, etc.&lt;br&gt; &lt;br&gt;Web Form Flooder is a Java console utility that analyzes a Web page, completes any forms present on the page with reasonable data, and submits the data. It crawls links within the site in order to identify and flood additional forms that may be present. It is great for load testing of Web forms, checking that all links work and that forms submit correctly.&lt;br&gt; &lt;br&gt;XmlTestSuite provides a powerful way to test Web applications. Writing tests requires only knowledge of HTML and XML. The authors want XmlTestSuite to be adopted by testers, business analysts, and Web developers who don&amp;#39;t have a Java background. XmlTestSuite supports &amp;quot;test-driven development&amp;quot;. It lets you separate page structure from tests and test data. It can also verify databases. It&amp;#39;s like JWebUnit, but has simple XML test definitions and reusable pages. The problems with raw HTTPUnit or JWebUnit are that:&lt;br&gt; &lt;br&gt;    It&amp;#39;s very hard to get non-programmers to write tests.&lt;br&gt;    Tests are so ugly you can&amp;#39;t read them. (Trust me; HttpUnit test classes are a nightmare to maintain.)&lt;br&gt;    Web tests generally change far more often than unit tests, and so need to be altered, but your refactoring won&amp;#39;t change them automatically (i.e., changing a JSP in IDEA will not cascade to the test like changing a class will). &lt;br&gt; &lt;br&gt;&lt;a href=&quot;http://www.brainjava.com/index.php?option=com_content&amp;amp;task=view&amp;amp;id=39&amp;amp;Itemid=35&quot;&gt;http://www.brainjava.com/index.php?option=com_content&amp;amp;task=view&amp;amp;id=39&amp;amp;Itemid=35&lt;/a&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/3611798996645350367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/3611798996645350367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3611798996645350367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/3611798996645350367'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/web-application-testing-tools-open.html' title='Web Application Testing Tools - Open Source'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-5009155791169275452</id><published>2011-04-10T01:57:00.001-07:00</published><updated>2011-04-10T01:57:41.387-07:00</updated><title type='text'>Developers still skeptical of Oracle’s stewardship of Java</title><content type='html'>LAS VEGAS – Java developers say they are still wary of how Oracle will shepherd the Java programming languages despite Oracle executives&#39; claims that they plan to keep Java &quot;vibrant.&quot;&lt;br&gt;&lt;br&gt;It has been more than a year since Oracle completed its acquisition of Sun Microsystems and, hence, of Java. Some developers at TheServerSide Java Symposium in Las Vegas this week said they haven&#39;t seen as much of a commitment to the Java community as they would like, and they&#39;re skeptical about Oracle&#39;s intention with Java.&lt;br&gt; &lt;br&gt;&quot;The community aspect of Java is disappearing,&quot; said Deva, senior developer for a health care company who didn&#39;t want his last name or company name used because of corporate rules about speaking to the press. &quot;The way Oracle is handling Java is making developers really nervous.&quot;&lt;br&gt; &lt;br&gt;Deva continued, saying that he thinks Oracle is pushing hard on the marketing side of Java and not as much on the open source aspect of it, which, he said, &quot;has been the soul of Java.&quot;&lt;br&gt;&lt;br&gt;Stephen Wilson, systems engineer for a leading software company, said he wonders what Oracle CEO Larry Ellison&#39;s &quot;end game&quot; is. &quot;You wonder if he&#39;s going to bring everyone into Java, and then flip a switch and say, &#39;Sorry, now you have to pay for it&#39;.&quot;&lt;br&gt; &lt;br&gt;&quot;(Ellison) wants to own every piece of the IT organization,&quot; Wilson added. &quot;He&#39;s not out there to be a philanthropist.&quot;&lt;br&gt;&lt;br&gt;Not everyone agrees, however.&lt;br&gt;&lt;br&gt;&quot;Initially I figured that Oracle just wanted to profit on Java,&quot; said Carlos Alfonzo Ortiz, architect at Cartagena Regional Port in Columbia. &quot;After hearing them today, I think they have a good plan for their platform.&quot;&lt;br&gt; &lt;br&gt;James Gosling, considered the father of Java, said during his keynote session at the Java Symposium that it is in Oracle&#39;s own interest to &quot;not be really aggressively stupid.&quot; But he said it&#39;s been clear that Oracle didn&#39;t exactly know what it was getting into with the acquisition of Java.&lt;br&gt; &lt;br&gt;&quot;It&#39;s been clear that they didn&#39;t understand what they bought; what it meant to deal with communities and people, and all the arguing and discussion and consensus building that&#39;s involved in communities,&quot; he said.&lt;br&gt; &lt;br&gt;Oracle executives said they understand the skepticism among developers but feel that if they keep releasing new features of the Java platform that eventually people will come around. Adam Messinger, VP of development for Oracle Fusion Middleware, acknowledged that most people see Oracle as a company that is focused first and foremost on making money. He didn&#39;t deny the claim in any way, saying only that the company seeks to develop and support Java simply because Java is the foundation for so much of what Oracle offers in the middleware and application space.&lt;br&gt; &lt;br&gt;&quot;On the strategy, it&#39;s not like it&#39;s benevolent exactly,&quot; he said. &quot;It is more or less enlightened self-interest.&quot;&lt;br&gt;&lt;br&gt;He later added that &quot;the focus is definitely on keeping the businesses that we had already built on top of Java healthy and growing.&quot;&lt;br&gt; &lt;br&gt;SOURCE:&lt;a href=&quot;http://www.theserverside.com/news/2240033465/Developers-still-skeptical-of-Oracles-stewardship-of-Java&quot;&gt;http://www.theserverside.com/news/2240033465/Developers-still-skeptical-of-Oracles-stewardship-of-Java&lt;/a&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/5009155791169275452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/5009155791169275452' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5009155791169275452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5009155791169275452'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/developers-still-skeptical-of-oracles.html' title='Developers still skeptical of Oracle’s stewardship of Java'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-6780859460236627134</id><published>2011-04-10T01:56:00.001-07:00</published><updated>2011-04-10T01:56:56.802-07:00</updated><title type='text'>Java Application Testing Tools</title><content type='html'>Many organizations are surprised to find that it is more expensive to do testing using tools. In order to gain benefits from testing tools, careful thought must be given for which tests you want to use tools and to the tool being chosen. &lt;br&gt; &lt;br&gt;One of the most widely-used tools is Abbot, a framework for testing Java GUIs. Using simple XML-based scripts, we can launch a GUI, play back arbitrary user actions on it, and examine its state. It also includes a script editor (Costello) that records user actions. The framework may be invoked directly from Java code (JUnit) or accessed without programming through the use of scripts. It is suitable for use both by developers for unit tests and QA for functional testing, especially with JFC swing. This tool has an excellent development team, which constantly updates the software.&lt;br&gt; &lt;br&gt;DejaGnu is a framework for testing applications such as Tcl, C, C++, Java, and network applications, and cross testing embedded systems. Its purpose is to provide a single frontend for all tests. Think of it as a custom library of Tcl procedures crafted to support writing a test harness. A &amp;quot;test harness&amp;quot; is the testing infrastructure that is created to support a specific program or tool. Each program can have multiple test suites, all supported by a single test harness. DejaGnu is written in Expect, which in turn uses Tcl, Tool Command Language. There has not been a new release in quite a while, although the snapshots are quite stable.&lt;br&gt; &lt;br&gt;The JavaTest™ harness is a general purpose Open Source Java API for creating Java test software, a fully-featured, flexible, and configurable test harness very well suited for most types of unit testing, especially Technology Compatibility Kit (TCK) test suites. The JavaTest harness is an excellent tool for configuring, sequencing, and running test suites that consist of large numbers of discrete, independent tests. It is especially good at testing APIs and compilers. Originally developed as a test harness to run the JCK test suite, it has since evolved into a general-purpose test platform well suited for use with all TCK test suites.&lt;br&gt; &lt;br&gt;JFunc is an extension to the JUnit testing framework to make it easier for use with functional tests. Functional testing (also called integration testing) significantly differs from unit testing in a number of respects. Part of this project is dedicated towards putting together code to address these differences; the other part of this project is putting together methodologies for functional testing.&lt;br&gt; &lt;br&gt;Marathon is a general-purpose tool for both running and authoring acceptance tests geared at the Java Platform Version 1.3 or later. Included with marathon is a rich suite of components to help you interact with your application at the User interface Level (GUI). To aid with the regression testing of existing applications, Marathon comes bundled with a recorder to capture events as you use and interact with your application. These events are then converted into a valid Marathon test, which can subsequently be played back.&lt;br&gt; &lt;br&gt;Pounder is a utility for testing Java GUIs. It allows developers to dynamically load components, record scripts, and then use those scripts in JUnit. It supports custom components, drag-and-drop, and the examination of test runs in source.&lt;br&gt; &lt;br&gt;QAT was developed to ease the issues encountered by having to perform Quality Assurance tests across a variety of hardware and software combinations. The way to achieve this is to abstract the process of running the test on a machine. So, from a tester&amp;#39;s point of view, there is one test suite, which the tester executes, and then gets the results for further analysis. The specifics of the machine on which the test will be run is completely hidden, and is necessary for running the test.&lt;br&gt; &lt;br&gt;The QAT tool can be divided into two main sections, the Agent, responsible for actually running each test or group of tests, and the Harness, which is responsible for test selection, management, results, and agent co-ordination. It can be accessed via a browser interface if remote access to the harness is required.&lt;br&gt; &lt;br&gt;First, each test case is written in a platform-independent way in a simple scripting language, very similar to C shell, although it could be implemented as any language you want. All references to platform-specific items are delayed by referring to one or more configuration files. A configuration is then built for each test based on the architecture and operating system of the target machine. So, instead of directly executing a command within the test, we refer to variables, which will only be defined at the time of running the test.&lt;br&gt; &lt;br&gt;Once the test case is ready, the test is transferred to whatever machine we want to run it on (agent). This is achieved by developing a relatively stupid agent that can respond to a limited set of requests from the harness via TCP sockets. Some examples are GETFILE, SENDFILE, DELFILE, EXECUTE, etc. The test script running on the harness may then use this command set to build a desired environment on the agent. We are able to transfer files, unzip files, delete files, set environment variables, and any of the other good things we need to run a test. Once the test is run, a result is decided on and sent back to the harness for processing.&lt;br&gt; &lt;br&gt;Since the agent is written in Java, it runs on any architecture supporting a JVM, including restricted ones running pJava, kJava, and various other slimmed-down versions.&lt;br&gt;&lt;br&gt;SOURCE:&lt;a href=&quot;http://www.brainjava.com/index.php?option=com_content&amp;amp;task=view&amp;amp;id=38&amp;amp;Itemid=35&quot;&gt;http://www.brainjava.com/index.php?option=com_content&amp;amp;task=view&amp;amp;id=38&amp;amp;Itemid=35&lt;/a&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/6780859460236627134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/6780859460236627134' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/6780859460236627134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/6780859460236627134'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/java-application-testing-tools.html' title='Java Application Testing Tools'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-5907463029653097618</id><published>2011-04-10T01:55:00.001-07:00</published><updated>2011-04-10T01:55:46.382-07:00</updated><title type='text'>How to fix the JCP? Participate</title><content type='html'>During a keynote panel at TheServerSide Java Symposium on Thursday, Patrick Curran, James Gosling and Reza Rahman all said that participation is key to making the JCP work as it should, in a democratic fashion.&lt;br&gt;&lt;br&gt;&amp;quot;We have a responsibility to keep an eye on what&amp;#39;s going on,&amp;quot; Rahman, a Java consultant and author. said. &amp;quot;Democracy is participation. If you don&amp;#39;t participate and just complain about it, you&amp;#39;re just on one side of that two-way street.&amp;quot;&lt;br&gt; &lt;br&gt;Cameron McKenzie, editor of TheServerSide.com, moderated the panel.&lt;br&gt;&lt;br&gt;One attendee asked how busy Java developers can really get involved before a certain Java Specification Request (JSR) is fully baked. Curran, the head of the JCP, had a suggestion.&lt;br&gt; &lt;br&gt;&amp;quot;The simplest way is to follow a JSR that you&amp;#39;re interested in,&amp;quot; he said. &amp;quot;You can read the spec, you can comment on it. I think the main thing is to watch what&amp;#39;s happening.&amp;quot;&lt;br&gt;&lt;br&gt;Gosling, considered the father of Java, added that oftentimes the comments come too late, after the JSR is fully baked. To which Gosling replied: &amp;quot;There was a huge review cycle and you didn&amp;#39;t show up?&amp;quot;&lt;br&gt; &lt;br&gt;    Overall we&amp;#39;re trying to make sure people participate in the process smoothly. Most important we want to make it open so people can see what&amp;#39;s happening.&lt;br&gt;&lt;br&gt;    Patrick Curran, head of the Java Community Process (JCP)&lt;br&gt; &lt;br&gt;That said, all three said there were ways in which the JCP could improve. Curren, for example, said that the majority of JSRs out there have someone from Oracle as the spec lead. While he and Rahman said they wished there were more spec leads from other companies, they agreed that, as Rahman put it, it is somewhat of a &amp;quot;necessary evil&amp;quot; that Oracle is so prominent.&lt;br&gt; &lt;br&gt;&amp;quot;A significant portion of the work to be done should be done by Oracle,&amp;quot; Curran said.&lt;br&gt;&lt;br&gt;Gosling added that one way to improve the JCP would be for participants to keep their conflicted interests separate.&lt;br&gt; &lt;br&gt;&amp;quot;Number 1 is to leave the politics at the door,&amp;quot; he said. &amp;quot;Number 2 is transparency. One of the problems all the expert groups get into is that you have people who with one hat they&amp;#39;re engineers, and the other hat they&amp;#39;re employees of some corporation. So there are competing agendas.&amp;quot;&lt;br&gt; &lt;br&gt;Curran agreed with Gosling&amp;#39;s call for transparency.&lt;br&gt;&lt;br&gt;&amp;quot;Overall we&amp;#39;re trying to make sure people participate in the process smoothly,&amp;quot; he said. &amp;quot;Most important we want to make it open so people can see what&amp;#39;s happening.&amp;quot;&lt;br&gt; &lt;br&gt;SOURCE:&lt;a href=&quot;http://www.theserverside.com/news/2240033488/How-to-fix-the-JCP-Participate&quot;&gt;http://www.theserverside.com/news/2240033488/How-to-fix-the-JCP-Participate&lt;/a&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/5907463029653097618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/5907463029653097618' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5907463029653097618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/5907463029653097618'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/how-to-fix-jcp-participate.html' title='How to fix the JCP? Participate'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7397206376271418817.post-8471157340777498404</id><published>2011-04-10T01:54:00.001-07:00</published><updated>2011-04-10T01:54:23.279-07:00</updated><title type='text'>SCJP Exam for J2SE 5-A Concise, Comprehensive Study Guide for The Sun Certified</title><content type='html'># Paperback: 350 pages&lt;br&gt;# Publisher: Apress; Study Gd edition (May 30, 2006)&lt;br&gt;# Language: English&lt;br&gt;# ISBN: 1590596978&lt;br&gt;# Product Dimensions: 9.2 x 7.4 x 0.9 inches&lt;br&gt;&lt;br&gt;Best selling author, Paul Sanghera, offers cohesive, concise, yet comprehensive coverage of all the topics included in the Sun Certified Programmer for Java 5 exam (CX 310-055). With a laser sharp focus on the exam objectives, the Study Guide goes beyond just being an &amp;quot;exam cram.&amp;quot; The material is presented in a logical learning sequence: a section builds upon previous sections and a chapter on previous chapters. All concepts, simple and complex, are defined and explained when they appear the first time. There is no hopping from topic to topic and no technical jargon without explanation. No prior knowledge of Java programming is assumed. The single most difficult aspect of this exam is to read and understand the code in the exam questions in a limited amount of time. To help you get fluent and comfortable with the code, the book offers complete runnable code examples distributed over all the chapters and a codewalk quicklet feature at the end of each chapter.&lt;br&gt; &lt;br&gt;Although the primary purpose of the book is to help you pass the SCJP exam, it will also serve as a good reference after the exam.&lt;br&gt;&lt;br&gt;Special features include&lt;br&gt;&lt;br&gt;Hundreds of questions modeled after the real exam with fully explained answers.&lt;br&gt; A complete practice exam with questions modeled after the real exam and fully explained answers.&lt;br&gt;Hundreds of complete runnable code examples, explained in the book, that you can download and experiment with. This is a code-intensive exam.&lt;br&gt; The Codewalk Quicklet feature based on the process-based codewalk philosophy to prepare you for efficient response to the code-based questions in the exam.&lt;br&gt;The Exam Quick Prep feature which recaps all the important points for the last hour of preparation before taking the exam.&lt;br&gt; Useful information and analysis for the programmers who are considering updating the J2SE 1.4 certification to J2SE 5.&lt;br&gt;&lt;br&gt;Download:&lt;br&gt;&lt;a href=&quot;http://rapidshare.com/files/1259710/Apress.SCJP.Exam.for.J2SE.5.May.2006.rar&quot;&gt;http://rapidshare.com/files/1259710/Apress.SCJP.Exam.for.J2SE.5.May.2006.rar&lt;/a&gt;&lt;br&gt; &lt;br&gt;SOURCE:&lt;a href=&quot;http://www.brainjava.com/index.php?option=com_smf&amp;amp;Itemid=30&amp;amp;?topic=4.0&quot;&gt;http://www.brainjava.com/index.php?option=com_smf&amp;amp;Itemid=30&amp;amp;?topic=4.0&lt;/a&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://javaapplication32.blogspot.com/feeds/8471157340777498404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7397206376271418817/8471157340777498404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8471157340777498404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7397206376271418817/posts/default/8471157340777498404'/><link rel='alternate' type='text/html' href='http://javaapplication32.blogspot.com/2011/04/scjp-exam-for-j2se-5-concise.html' title='SCJP Exam for J2SE 5-A Concise, Comprehensive Study Guide for The Sun Certified'/><author><name>JAVA APPLICATION</name><uri>http://www.blogger.com/profile/17509224399943127055</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>