<?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: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-5250146174432122339</id><updated>2011-04-21T14:25:26.655-07:00</updated><category term='Ant'/><title type='text'>Blowing Wind</title><subtitle type='html'>A Technical Knowledge Sharing Blog</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>SiLver Surfer</name><uri>http://www.blogger.com/profile/03243111172825129435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_PcpMyt9rclU/R9JcdDSi9CI/AAAAAAAAAAk/o_InREIUi3w/S220/images.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-6128386286861771854</id><published>2008-05-13T07:33:00.000-07:00</published><updated>2008-05-13T07:36:41.979-07:00</updated><title type='text'>Luntbuild : Installation</title><content type='html'>This is the second part of the little notes about Luntbuild. This gives some basic installation steps of Luntbuild. For an introduction on Luntbuild refer &lt;a href="http://thetalkouttrojans.blogspot.com/2008/05/luntbuild-introduction.html"&gt;this post&lt;/a&gt;.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Using zip distribution (without GUI), in Linux&lt;/li&gt;&lt;li&gt;Using Luntbuild installer (with GUI), in Linux&lt;/li&gt;&lt;li&gt;Using Luntbuild installer (with GUI), in Windows&lt;/li&gt;&lt;/ol&gt;via: &lt;a href="http://thetalkouttrojans.blogspot.com/2008/05/luntbuild-installation.html"&gt;http://thetalkouttrojans.blogspot.com/2008/05/luntbuild-installation.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-6128386286861771854?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/6128386286861771854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=6128386286861771854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6128386286861771854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6128386286861771854'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/05/luntbuild-installation.html' title='Luntbuild : Installation'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-1947582129260433379</id><published>2008-05-06T10:34:00.001-07:00</published><updated>2008-05-06T10:34:55.654-07:00</updated><title type='text'>Luntbuild : Introduction</title><content type='html'>&lt;i&gt;&lt;b&gt;Luntbuild &lt;/b&gt;&lt;/i&gt;is a powerful build automation and management tool. Continuous Integration or nightly builds can be easily set using a clean web interface. Executed builds are well managed using functions such as search, categorization, promotion, patching, deletion, etc. It also acts as a central build artifacts repository and download area for your whole team.&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;via: &lt;a href="http://thetalkouttrojans.blogspot.com/2008/05/luntbuild-introduction.html"&gt;http://thetalkouttrojans.blogspot.com/2008/05/luntbuild-introduction.html&lt;/a&gt;&lt;br&gt; &lt;/div&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-1947582129260433379?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/1947582129260433379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=1947582129260433379' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/1947582129260433379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/1947582129260433379'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/05/luntbuild-introduction.html' title='Luntbuild : Introduction'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-1049742123038306846</id><published>2008-04-27T08:41:00.001-07:00</published><updated>2008-04-27T08:41:33.031-07:00</updated><title type='text'>JUnit</title><content type='html'>Ref:  &lt;ul&gt;&lt;li&gt;&lt;a href="http://junit.sourceforge.net/doc/faq/faq.htm" target="_blank"&gt;&lt;span&gt;http://junit.sourceforge.net/doc/faq/faq.htm&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://open.ncsu.edu/se/tutorials/junit/" target="_blank"&gt;&lt;span&gt;http://open.ncsu.edu/se/tutorials/junit/&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://junit.sourceforge.net/javadoc/" target="_blank"&gt;&lt;span&gt;API DOC&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;What is JUnit?&lt;/h2&gt; &lt;p&gt; JUnit is a simple, open source framework to write and run repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. JUnit features include: &lt;/p&gt; &lt;ul&gt;&lt;li&gt;Assertions for testing expected results &lt;/li&gt;&lt;li&gt;Test fixtures for sharing common test data &lt;/li&gt;&lt;li&gt;Test runners for running tests &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;When should tests be written?&lt;/h2&gt; &lt;blockquote&gt; &lt;p&gt;Tests should be written before the code. Test-first programming is practiced by only writing new code when an automated test is failing. &lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;Good tests tell you how to best design the system for its intended use. They effectively communicate in an executable format how to use the software. They also prevent tendencies to over-build the system based on speculation. When all the tests pass, you know you&amp;#39;re done! &lt;/p&gt; &lt;p&gt;Whenever a customer test fails or a bug is reported, first write the necessary unit test(s) to expose the bug(s), then fix them. This makes it almost impossible for that particular bug to resurface later. &lt;/p&gt; &lt;p&gt; Test-driven development is a lot more fun than writing tests after the code seems to be working. Give it a try!  &lt;/p&gt; &lt;h2&gt;Basic test template&lt;/h2&gt; &lt;pre&gt;import org.junit.*;&lt;br&gt;import static org.junit.Assert.*;&lt;br&gt;&lt;br&gt;public class SampleTest {&lt;br&gt;&lt;br&gt;    private java.util.List emptyList;&lt;br&gt;&lt;br&gt;    /**&lt;br&gt;     * Sets up the test fixture. &lt;br&gt;     * (Called before every test case method.)&lt;br&gt;        */&lt;br&gt;    @Before&lt;br&gt;    public void setUp() {&lt;br&gt;        emptyList = new java.util.ArrayList();&lt;br&gt;    }&lt;br&gt;&lt;br&gt;    /**&lt;br&gt;     * Tears down the test fixture. &lt;br&gt;     * (Called after every test case method.)&lt;br&gt;     */&lt;br&gt;       @After&lt;br&gt;    public void tearDown() {&lt;br&gt;        emptyList = null;&lt;br&gt;    }&lt;br&gt;    &lt;br&gt;    @Test&lt;br&gt;    public void testSomeBehavior() {&lt;br&gt;        assertEquals(&amp;quot;Empty list should have 0 elements&amp;quot;, 0, emptyList.size());&lt;br&gt;       }&lt;br&gt;&lt;br&gt;    @Test(expected=IndexOutOfBoundsException.class)&lt;br&gt;    public void testForException() {&lt;br&gt;        Object o = emptyList.get(0);&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;h2&gt;Handling Exception&lt;/h2&gt; &lt;h3&gt;* How test that passes when an expected exception is thrown?&lt;/h3&gt; &lt;blockquote&gt; &lt;p&gt;Add the optional expected attribute to the @Test annotation. The following is an example test that passes when the expected IndexOutOfBoundsException is raised: &lt;/p&gt; &lt;pre&gt;    @Test(expected=IndexOutOfBoundsException.class)&lt;br&gt;    public void testIndexOutOfBoundsException() {&lt;br&gt;        ArrayList emptyList = new ArrayList();&lt;br&gt;	Object o = emptyList.get(0);&lt;br&gt;    }&lt;br&gt;&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;     &lt;/p&gt; &lt;h3&gt;* How test that fails when an unexpected exception is thrown?&lt;/h3&gt; &lt;blockquote&gt; &lt;p&gt;Declare the exception in the throws clause of the test method and don&amp;#39;t catch the exception within the test method. Uncaught exceptions will cause the test to fail with an error. &lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt; The following is an example test that fails when the IndexOutOfBoundsException is raised: &lt;/p&gt; &lt;pre&gt;    @Test&lt;br&gt;    public void testIndexOutOfBoundsExceptionNotRaised() &lt;br&gt;        throws IndexOutOfBoundsException {&lt;br&gt;    &lt;br&gt;        ArrayList emptyList = new ArrayList();&lt;br&gt;        Object o = emptyList.get(0);&lt;br&gt;       }&lt;br&gt;&lt;/pre&gt;&lt;h2&gt;Assertion Statement Reference&lt;/h2&gt; &lt;p&gt;This is a list of the different types of assertion statements that are used to test your code. Any Java data type or object can be used in the statement. These assertions are taken from the &lt;a href="http://junit.sourceforge.net/javadoc/" target="_blank"&gt;&lt;span&gt;JUnit API&lt;/span&gt;&lt;/a&gt;. &lt;/p&gt; &lt;ul&gt;&lt;li&gt;assertEquals(expected, actual) &lt;/li&gt;&lt;li&gt;assertEquals(message, expected, actual) &lt;/li&gt;&lt;li&gt;assertEquals(expected, actual, delta) - used on doubles or floats, where delta is the difference in precision &lt;/li&gt;&lt;li&gt;assertEquals(message, expected, actual, delta) - used on doubles or floats, where delta is the difference in precision &lt;/li&gt;&lt;li&gt;assertFalse(condition) &lt;/li&gt;&lt;li&gt;assertFalse(message, condition) &lt;/li&gt;&lt;li&gt;assertNotNull(object) &lt;/li&gt;&lt;li&gt;assertNotNull(message, object) &lt;/li&gt;&lt;li&gt;assertNotSame(expected, actual) &lt;/li&gt;&lt;li&gt;assertNotSame(message, expected, actual) &lt;/li&gt;&lt;li&gt;assertNull(object) &lt;/li&gt;&lt;li&gt;assertNull(message, object) &lt;/li&gt;&lt;li&gt;assertSame(expected, actual) &lt;/li&gt;&lt;li&gt;assertSame(message, expected, actual) &lt;/li&gt;&lt;li&gt;assertTrue(condition) &lt;/li&gt;&lt;li&gt;assertTrue(message, condition) &lt;/li&gt;&lt;li&gt;fail() &lt;/li&gt;&lt;li&gt;fail(message) &lt;/li&gt;&lt;li&gt;failNotEquals(message, expected, actual) &lt;/li&gt;&lt;li&gt;failNotSame(message, expected, actual) &lt;/li&gt;&lt;li&gt;failSame(message) &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; Ref:  &lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href="http://open.ncsu.edu/se/tutorials/junit/" target="_blank"&gt;&lt;span&gt;http://open.ncsu.edu/se/tutorials/junit/&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://junit.sourceforge.net/doc/faq/faq.htm" target="_blank"&gt;&lt;span&gt;http://junit.sourceforge.net/doc/faq/faq.htm&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Pre and Post condition&lt;/h2&gt; &lt;ul&gt;&lt;li&gt;A pre-condition is an expression of type Boolean that should always hold before the execution of the body of the method,conditions for each function that must be true for it to behave correctly &lt;/li&gt;&lt;li&gt;A post-condition is an expression of type Boolean that should always hold after the execution of the body of the method,conditional expressions that must be true when a method returns &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The strategy is to construct a JUnit test case for each accessible method in the class under test, where each test case verifies both the preconditions and postconditions of the method. Example &lt;pre&gt;public class RangeTest extends TestCase {  &lt;br&gt;  private Range mRange;&lt;br&gt;  public RangeTest(String name) {  &lt;br&gt;    super(name); &lt;br&gt;   }&lt;br&gt;&lt;br&gt;  protected void setUp() throws Exception {&lt;br&gt;    super.setUp();&lt;br&gt;       mRange = new Range(1, 5); &lt;br&gt;  }&lt;br&gt;&lt;br&gt;  public void testConstructor() { &lt;br&gt;    // pre: aLower &amp;lt; aUpper&lt;br&gt;    try {  &lt;br&gt;      new Range(6, 4);&lt;br&gt;      fail(&amp;quot;[6,4] should be precluded&amp;quot;);&lt;br&gt;    } &lt;br&gt;       catch (AssertionError e) {    }&lt;br&gt;    // pre: aLower == aUpper    new Range(-3, -3);&lt;br&gt;    // post: aLower == getLower()&lt;br&gt;    Assert.assertEquals(&amp;quot;[1,5].getLower() should be 1&amp;quot;, 1,&lt;br&gt;       mRange.getLower());&lt;br&gt;       // post: aUpper == getUpper()&lt;br&gt;    Assert.assertEquals(&amp;quot;[1,5].getUpper() should be 5&amp;quot;, 5,&lt;br&gt;       mRange.getUpper());&lt;br&gt;  }&lt;br&gt;&lt;br&gt;  public void testGetLower() {&lt;br&gt;    // pre: object constructed&lt;br&gt;    Assert.assertNotNull(&amp;quot;[1,5] could not be constructed&amp;quot;, mRange);&lt;br&gt;       // post: getLower() == aLower provided to c&amp;#39;tor &lt;br&gt;    Assert.assertEquals(&amp;quot;[1,5].getLower() should be 1&amp;quot;, 1,&lt;br&gt;      mRange.getLower());&lt;br&gt;  }&lt;br&gt;&lt;br&gt;  public void testGetUpper() { &lt;br&gt;    // pre: object constructed&lt;br&gt;       Assert.assertNotNull(&amp;quot;[1,5] could not be constructed&amp;quot;,&lt;br&gt;      mRange);&lt;br&gt;    // post: getUpper() == aUpper provided to c&amp;#39;tor &lt;br&gt;    Assert.assertEquals(&amp;quot;[1,5].getUpper() should be 5&amp;quot;, 5,&lt;br&gt;         mRange.getUpper());&lt;br&gt;  }&lt;br&gt;&lt;br&gt;  public void testIntersects() {&lt;br&gt;    // pre: anOther !=  null &lt;br&gt;    try {&lt;br&gt;      mRange.intersects(null);&lt;br&gt;      fail(&amp;quot;intersects(null) should be precluded&amp;quot;);&lt;br&gt;       }&lt;br&gt;    catch (AssertionError e) {    } &lt;br&gt;      // post: true if two ranges have an integer in common&lt;br&gt;      Assert.assertTrue(!mRange.intersects(new Range(-3, -1)));&lt;br&gt;      Assert.assertTrue(!mRange.intersects(new Range(6, 7)));&lt;br&gt;         Assert.assertTrue(!mRange.intersects(new Range(-2, 1)));&lt;br&gt;      Assert.assertTrue(!mRange.intersects(new Range(5, 7)));&lt;br&gt;      Assert.assertTrue(mRange.intersects(new Range(0, 2)));&lt;br&gt;      Assert.assertTrue(mRange.intersects(new Range(3, 4)));&lt;br&gt;         Assert.assertTrue(mRange.intersects(new Range(4, 8)));&lt;br&gt;}}&lt;br&gt;&lt;br&gt;&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;If these test cases pass, then we can be confident that all methods in Range are: &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Checking for violation of their preconditions (and objecting by throwing a Runtime exception of some sort) &lt;/li&gt;&lt;li&gt;Adhering to their postconditions. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;       &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt; Ref: &lt;a href="http://www.hacknot.info/hacknot/action/showEntry?eid=17" target="_blank"&gt;&lt;span&gt;http://www.hacknot.info/hacknot/action/showEntry?eid=17&lt;/span&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-1049742123038306846?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/1049742123038306846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=1049742123038306846' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/1049742123038306846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/1049742123038306846'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/04/junit.html' title='JUnit'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-6029931946026912692</id><published>2008-04-07T02:29:00.001-07:00</published><updated>2008-04-07T02:29:43.580-07:00</updated><title type='text'>Renaming a MySQL database</title><content type='html'>&lt;b&gt;&lt;a href="http://en.wikipedia.org/wiki/MySQL" target="_blank"&gt;MySQL&lt;/a&gt;&lt;/b&gt; does not support renaming a database &lt;i&gt;(and prefers not to be done in the supported versions)&lt;/i&gt; as mentioned &lt;a href="http://dev.mysql.com/doc/refman/5.1/en/rename-database.html" target="_blank"&gt;here&lt;/a&gt;. &lt;br clear="all"&gt;   &lt;br&gt;&lt;blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"&gt;However, use of this statement could result in loss of database         contents, which is why it was removed. Do not use         &lt;code&gt;RENAME DATABASE&lt;/code&gt; in earlier versions in which         it is present.&lt;br&gt;&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;But there might be times when you want to do this, and the simple workaround I use is this.&lt;/li&gt;&lt;li&gt;Just export the current database. You can use &lt;b&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html" target="_blank"&gt;mysqldump&lt;/a&gt;&lt;/b&gt; or any other GUI tool like &lt;b&gt;&lt;a href="http://en.wikipedia.org/wiki/HeidiSQL" target="_blank"&gt;HeidiSQL&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href="http://en.wikipedia.org/wiki/PhpMyAdmin" target="_blank"&gt;phpMyAdmin&lt;/a&gt;&lt;/b&gt;.&lt;b&gt;&lt;code&gt;&lt;/code&gt;&lt;/b&gt;&lt;/li&gt;   &lt;li&gt;The dump         typically contains SQL statements to create the table, populate         it, or both.&lt;/li&gt;&lt;li&gt;Then create a database with the name you want, the new database.&lt;/li&gt;&lt;li&gt;Then just &lt;b&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html" target="_blank"&gt;mysqlimport&lt;/a&gt;&lt;/b&gt; the exported SQL file to the new database you just created.&lt;/li&gt;   &lt;li&gt;Final step would be to &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/drop-database.html" target="_blank"&gt;drop&lt;/a&gt; the old database.&lt;/li&gt;&lt;/ul&gt; Also note,&lt;br&gt;&lt;blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"&gt;         If you are doing a backup on the server and your tables all are         &lt;code&gt;MyISAM&lt;/code&gt; tables, consider using the         &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/mysqlhotcopy.html" target="_blank"&gt;&lt;span&gt;&lt;b&gt;mysqlhotcopy&lt;/b&gt;&lt;/span&gt;&lt;/a&gt; instead because it can         accomplish faster backups and faster restores.&lt;/blockquote&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;i&gt;This is not big deal and just a matter of simple workaround, thats all.&lt;/i&gt; So I&amp;#39;m sure there is no way one could get doubts on this. Still if you get any I might be able to give a hand. Feedback and questions are welcome via comment or you can email me at &lt;tt&gt;talkout AT SPAMFREE gmail DOT com&lt;br&gt;   &lt;/tt&gt;&lt;br&gt;&amp;nbsp;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-6029931946026912692?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/6029931946026912692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=6029931946026912692' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6029931946026912692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6029931946026912692'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/04/renaming-mysql-database.html' title='Renaming a MySQL database'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-8847629036836759233</id><published>2008-03-23T14:00:00.000-07:00</published><updated>2008-03-23T14:01:00.103-07:00</updated><title type='text'>Ant: Simple JUnit Test</title><content type='html'>&lt;div&gt;     &lt;div&gt; &lt;p&gt;This is the &lt;i&gt;final &lt;/i&gt;part of the &lt;i&gt;so called Ant series&lt;/i&gt; I have been writing in this blog, about Apache Ant. This is an extremely brief tutorial on JUnit. The goal is to test Ant and JUnit framework integration .&lt;br&gt;&lt;br&gt;The previous posts on Ant can be found here:&lt;br&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html" target="_blank"&gt;Apache Ant&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-installation.html" target="_blank"&gt;Ant: Installation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html" target="_blank"&gt;Ant: Hello World in Ant&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;span&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-java-hello-world-in-ant.html" target="_blank"&gt;Ant: Java Hello World in Ant&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/03/ant-java-swing-hello-world-in-ant.html" target="_blank"&gt;Ant: Java Swing Hello World in Ant&lt;/a&gt;&lt;br&gt;  &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h3&gt;Prerequisites&lt;/h3&gt;&lt;p&gt;In order to do this we will need to have a &lt;a href="http://java.sun.com/" target="_blank"&gt;&lt;span&gt;Java compiler&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://ant.apache.org/" target="_blank"&gt;&lt;span&gt;Ant&lt;/span&gt;&lt;/a&gt;, and &lt;a href="http://junit.org/" target="_blank"&gt;&lt;span&gt;JUnit&lt;/span&gt;&lt;/a&gt; installed. &lt;/p&gt; &lt;h3&gt;Java Classes&lt;br&gt;&lt;/h3&gt;&lt;p&gt;First, we need a Java class to test. I had to make this example too simple according to my Java knowledge. This lacks any Java Docs or comments, but it&amp;#39;s a pretty simple bit of code. :) &lt;/p&gt; &lt;pre&gt;public class Math {&lt;br&gt;	static public int add(int a, int b) {&lt;br&gt;		return a + b;&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	static public int multiply ( int a, int b) {&lt;br&gt;		return a * b;&lt;br&gt;	}&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;p&gt; Then to test this code, we need a second Java class that will &lt;/p&gt; &lt;ol&gt;&lt;li&gt;import junit.framework.* &lt;/li&gt;&lt;li&gt;extend TestCase &lt;/li&gt;&lt;/ol&gt;&lt;p&gt; There are two important points to note in the sample. First, the routine is named &lt;i&gt;testAdd&lt;/i&gt;. This convention tells that the routine is supposed to be a test and that it&amp;#39;s targeting the &lt;i&gt;add&lt;/i&gt; functionality. Here&amp;#39;s the matching example. &lt;/p&gt; &lt;pre&gt;import junit.framework.*;&lt;br&gt;&lt;br&gt;public class TestMath extends TestCase { &lt;br&gt;&lt;br&gt;  protected void setUp() { &lt;br&gt;  	// put common setup code in here&lt;br&gt;  }&lt;br&gt;   &lt;br&gt;  protected void tearDown() {&lt;br&gt;  	// put common cleanup code in here&lt;br&gt; &lt;br&gt;&lt;br&gt;&lt;br&gt;  }&lt;br&gt;    &lt;br&gt;  public void testAdd() {&lt;br&gt;  	int num1 = 3;&lt;br&gt;  	int num2 = 2;&lt;br&gt;  	int total = 5;&lt;br&gt;  	int sum = 0;&lt;br&gt;  	sum = Math.add(num1, num2);&lt;br&gt;  	assertEquals(sum, total);&lt;br&gt;  }&lt;br&gt;  &lt;br&gt;  public void testMulitply() {&lt;br&gt; &lt;br&gt;&lt;br&gt;&lt;br&gt;  	int num1 = 3; &lt;br&gt;  	int num2 = 7; &lt;br&gt;  	int total = 21;&lt;br&gt;  	int sum = 0;&lt;br&gt;  	sum = Math.multiply(num1, num2);&lt;br&gt;  	assertEquals(&amp;quot;Problem with multiply&amp;quot;, sum, total);&lt;br&gt;  	&lt;br&gt;  	num1 = 5;&lt;br&gt;   	num2 = 4;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;  	total = 20;&lt;br&gt;  	sum = Math.multiply(num1, num2);&lt;br&gt;  	assertEquals(&amp;quot;Problem with multiply&amp;quot;, sum, total);&lt;br&gt;  }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;p&gt; And both these files could be kept in a sub-folder named &lt;i&gt;src&lt;/i&gt; &lt;/p&gt; &lt;h3&gt;Ant Script&lt;br&gt;&lt;/h3&gt;&lt;p&gt;The last step is how to run your JUnit tests using Ant. Create a file called &lt;i&gt;build.xml&lt;/i&gt; and place it in the main folder. The core of this scripts is the following, which does the JUnit tests. &lt;/p&gt; &lt;pre&gt;&amp;lt;junit printsummary=&amp;quot;yes&amp;quot; haltonfailure=&amp;quot;yes&amp;quot; showoutput=&amp;quot;yes&amp;quot; &amp;gt;&lt;br&gt;	&amp;lt;classpath&amp;gt;&lt;br&gt;		&amp;lt;pathelement path=&amp;quot;${build}&amp;quot;/&amp;gt;&lt;br&gt;		&amp;lt;fileset dir=&amp;quot;lib&amp;quot;&amp;gt;&lt;br&gt; &lt;br&gt;&lt;br&gt;&lt;br&gt;			&amp;lt;include name=&amp;quot;**/*.jar&amp;quot;/&amp;gt;&lt;br&gt;		&amp;lt;/fileset&amp;gt;&lt;br&gt;	&amp;lt;/classpath&amp;gt;&lt;br&gt; 	&amp;lt;batchtest fork=&amp;quot;yes&amp;quot; todir=&amp;quot;${reports}/raw/&amp;quot;&amp;gt;&lt;br&gt;		&amp;lt;formatter type=&amp;quot;xml&amp;quot;/&amp;gt;&lt;br&gt; 		&amp;lt;fileset dir=&amp;quot;${src}&amp;quot;&amp;gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;			&amp;lt;include name=&amp;quot;**/*Test*.java&amp;quot;/&amp;gt;&lt;br&gt;		&amp;lt;/fileset&amp;gt;&lt;br&gt;	&amp;lt;/batchtest&amp;gt;&lt;br&gt;&amp;lt;/junit&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;p&gt; The file I used is &lt;i&gt;&lt;a href="http://talkout.googlepages.com/build.xml" title="Attachment Ant/SimpleJUnitTest: build.xml" target="_blank"&gt;this one&lt;/a&gt;&lt;/i&gt;. (The inner details of this scripts are Ant Scripting and XML, which is not explained in this document, but really straightforward to understand) &lt;/p&gt; &lt;h3&gt;Output&lt;/h3&gt;&lt;p&gt;Run &lt;i&gt;ant test&lt;/i&gt; in command line: &lt;/p&gt; &lt;pre&gt;[root@nimal junit-sample]# ant test&lt;br&gt;Buildfile: build.xml&lt;br&gt;&lt;br&gt;init:&lt;br&gt;&lt;br&gt;compile:&lt;br&gt;    [javac] Compiling 2 source files to /opt/junit-sample/bin&lt;br&gt;&lt;br&gt;run-tests:&lt;br&gt;    [junit] Running TestMath&lt;br&gt;&lt;br&gt;    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.321 sec&lt;br&gt; &lt;br&gt;test:&lt;br&gt;[junitreport] Processing /opt/junit-sample/reports/TESTS-TestSuites.xml to /tmp/null1227203872&lt;br&gt;[junitreport] Loading stylesheet jar:file:/usr/local/ant/lib/ant-junit.jar!/org/apache/tools/ant&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; /taskdefs/optional/junit/xsl/junit-frames.xsl&lt;br&gt;[junitreport] Transform time: 1714ms&lt;br&gt;[junitreport] Deleting: /tmp/null1227203872&lt;br&gt;&lt;br&gt;BUILD SUCCESSFUL&lt;br&gt;Total time: 6 seconds&lt;br&gt;&lt;/pre&gt;&lt;p&gt;Ant will also do nice things like create nice HTML reports! I&amp;#39;ve linked to a simple Ant script that will compile all the code in your &amp;quot;src&amp;quot; folder, run all the tests named &amp;quot;test*&amp;quot; and then create an HTML report in your &amp;quot;reports\html&amp;quot; folder. &lt;/p&gt; &lt;p&gt; I&amp;#39;ve linked to a zip file (&lt;a href="http://talkout.googlepages.com/ant-junit-sample.zip" target="_blank"&gt;ant-junit-sample.zip&lt;/a&gt;) that contains the build.xml file, the source code and the test class. (If you try to run it and get errors about JUnit not being found, remember to add that &lt;i&gt;junit.jar&lt;/i&gt; to your Ant lib folder.) &lt;/p&gt; &lt;/div&gt;    &lt;/div&gt;&lt;h3&gt;Attachments&lt;/h3&gt;     &lt;ul&gt;&lt;li&gt;&lt;a href="http://talkout.googlepages.com/ant-junit-sample.zip" target="_blank"&gt;ant-junit-sample.zip&lt;/a&gt; (109.6 kB) -&lt;q&gt;Scripts for Test &lt;/q&gt;,&lt;/li&gt;&lt;li&gt;&lt;a href="http://talkout.googlepages.com/build.xml" target="_blank"&gt;build.xml&lt;/a&gt; (2.7 kB) -&lt;q&gt;Ant+JUnit build script &lt;/q&gt;, &lt;/li&gt;&lt;/ul&gt;&lt;a href="http://talkout.googlepages.com/ant-junit-sample.zip" target="_blank"&gt;&lt;/a&gt;&lt;br clear="all"&gt;&lt;a href="http://talkout.googlepages.com/build.xml" target="_blank"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-8847629036836759233?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/8847629036836759233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=8847629036836759233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/8847629036836759233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/8847629036836759233'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/03/ant-simple-junit-test.html' title='Ant: Simple JUnit Test'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-6087511365758643952</id><published>2008-03-06T23:36:00.001-08:00</published><updated>2008-03-06T23:36:25.416-08:00</updated><title type='text'>Ant: Java Swing Hello World in Ant</title><content type='html'>&lt;div&gt;     &lt;div&gt; &lt;h2&gt;&lt;font style="font-weight: normal;" size="2"&gt;This is the fourth part of the so called Ant series I have been writing in this blog, about Apache Ant. This post is mainly about building and running a &lt;i&gt;Java Swing program&lt;/i&gt; using Ant.&lt;br&gt; &lt;br&gt;The previous posts on Ant can be found here:&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; 1. &lt;a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html"&gt;Apache Ant&lt;/a&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; 2. &lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-installation.html"&gt;Ant: Installation&lt;/a&gt;&lt;br&gt; &amp;nbsp;&amp;nbsp; 3. &lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html"&gt;Ant: Hello World in Ant&lt;/a&gt;&lt;/font&gt;&lt;font&gt;&lt;font style="font-weight: normal;" size="2"&gt;&lt;br&gt; &amp;nbsp;&amp;nbsp; 4. &lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-java-hello-world-in-ant.html"&gt;Ant: Java Hello World in Ant&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;/h2&gt;&lt;h2&gt;&lt;u&gt;&lt;font size="2"&gt;Java Swing Program&lt;/font&gt;&lt;/u&gt;&lt;/h2&gt; &lt;p&gt; Create the following simple swing program and save it as &lt;i&gt;HelloWorldSwing.java&lt;/i&gt; in a sub folder &lt;i&gt;src&lt;/i&gt;: &lt;/p&gt; &lt;pre&gt;import javax.swing.JFrame;&lt;br&gt;import javax.swing.JLabel;&lt;br&gt;&lt;br&gt;public class HelloWorldSwing {&lt;br&gt;  public static void main(String[] args) {&lt;br&gt;    JFrame frame = new JFrame(&amp;quot;HelloWorldSwing&amp;quot;);     final JLabel label = new JLabel(&amp;quot;Hello World&amp;quot;);&lt;br&gt;    frame.getContentPane().add(label);&lt;br&gt;    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br&gt;    frame.pack();&lt;br&gt;    frame.setVisible(true);   }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;h2&gt;&lt;u&gt;&lt;font size="2"&gt;Ant Script&lt;/font&gt;&lt;/u&gt;&lt;/h2&gt; &lt;p&gt; Use a text editor to create a file called &lt;i&gt;build.xml&lt;/i&gt; and place it in the main folder: &lt;/p&gt; &lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br&gt;&amp;lt;project name=&amp;quot;Run Test&amp;quot; default=&amp;quot;run&amp;quot; basedir=&amp;quot;.&amp;quot;&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;clean&amp;quot;&amp;gt;         &amp;lt;delete dir=&amp;quot;build&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;compile&amp;quot; depends=&amp;quot;clean&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;mkdir dir=&amp;quot;build/classes&amp;quot;/&amp;gt;&lt;br&gt;        &amp;lt;javac srcdir=&amp;quot;src&amp;quot; destdir=&amp;quot;build/classes&amp;quot;/&amp;gt;     &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;jar&amp;quot; depends=&amp;quot;compile&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;mkdir dir=&amp;quot;build/jar&amp;quot;/&amp;gt;&lt;br&gt;        &amp;lt;jar destfile=&amp;quot;build/jar/HelloWorldSwing.jar&amp;quot; basedir=&amp;quot;build/classes&amp;quot;&amp;gt;             &amp;lt;manifest&amp;gt;&lt;br&gt;                &amp;lt;attribute name=&amp;quot;Main-Class&amp;quot; value=&amp;quot;HelloWorldSwing&amp;quot;/&amp;gt;&lt;br&gt;            &amp;lt;/manifest&amp;gt;&lt;br&gt;        &amp;lt;/jar&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;run&amp;quot; depends=&amp;quot;jar&amp;quot;&amp;gt;         &amp;lt;java jar=&amp;quot;build/jar/HelloWorldSwing.jar&amp;quot; fork=&amp;quot;true&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;/project&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;h2&gt;&lt;u&gt;&lt;font size="2"&gt;Outputs and Problems&lt;/font&gt;&lt;/u&gt;&lt;/h2&gt; &lt;p&gt; When we run this is text mode it, it compiles but fails to run. But when in GUI it runs. &lt;/p&gt; &lt;pre&gt;[root@sanjaya-vm ant-swing]# ant&lt;br&gt;Buildfile: build.xml&lt;br&gt;&lt;br&gt;clean:&lt;br&gt;   [delete] Deleting directory /opt/ant-swing/build&lt;br&gt;&lt;br&gt;compile:&lt;br&gt;    [mkdir] Created dir: /opt/ant-swing/build/classes&lt;br&gt;     [javac] Warning: HelloWorldSwing.java modified in the future.&lt;br&gt;    [javac] Compiling 1 source file to /opt/ant-swing/build/classes&lt;br&gt;&lt;br&gt;jar:&lt;br&gt;    [mkdir] Created dir: /opt/ant-swing/build/jar&lt;br&gt;      [jar] Building jar: /opt/ant-swing/build/jar/HelloWorldSwing.jar&lt;br&gt; &lt;br&gt;run:&lt;br&gt;     [java] Exception in thread &amp;quot;main&amp;quot; java.awt.HeadlessException: &lt;br&gt;     [java] No X11 DISPLAY variable was set, but this program performed an operation which requires it.&lt;br&gt;     [java]     at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)&lt;br&gt;      ...&lt;br&gt;     ...&lt;br&gt;    &amp;nbsp;[java]     at java.awt.Window.&amp;lt;init&amp;gt;(Window.java:406)&lt;br&gt;     [java]     at java.awt.Frame.&amp;lt;init&amp;gt;(Frame.java:402)&lt;br&gt;     [java]     at javax.swing.JFrame.&amp;lt;init&amp;gt;(JFrame.java:207)&lt;br&gt;      [java]     at HelloWorldSwing.main(Unknown Source)       [java] Java Result: 1&lt;br&gt;&lt;br&gt;BUILD SUCCESSFUL&lt;br&gt;Total time: 3 seconds&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;                        &lt;input name="action" value="edit" type="hidden"&gt;       This is one another basic level post and I strongly advice you to refer to any more advanced document, if you are going to do this for any production system. :)&lt;br clear="all"&gt;&lt;br&gt;Feedback and questions are welcome via comment or you can email me at &lt;tt&gt;talkout AT SPAMFREE gmail DOT com&lt;/tt&gt;&lt;br&gt; &amp;nbsp;&lt;br&gt;&amp;nbsp;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-6087511365758643952?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/6087511365758643952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=6087511365758643952' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6087511365758643952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6087511365758643952'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/03/ant-java-swing-hello-world-in-ant.html' title='Ant: Java Swing Hello World in Ant'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-3756413999058663370</id><published>2008-02-27T01:00:00.001-08:00</published><updated>2008-02-27T01:16:05.927-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ant'/><title type='text'>Ant: Java Hello World in Ant</title><content type='html'>&lt;div&gt;     &lt;div&gt;This is the third part of the so called Ant series I have been writing in this blog, about Apache Ant. This post is mainly about building and running a Java program using Ant. In the example I&amp;#39;m using here, its a Hello World program in simple Java, but most of these basic Ant steps would be same for any other Java program you might run.&lt;br&gt; &lt;br&gt;The previous posts on Ant can be found here:&lt;ol&gt;&lt;li&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html"&gt;Apache Ant&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-installation.html"&gt;Ant: Installation&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html"&gt;Ant: Hello World in Ant&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;&lt;font size="4"&gt;Java Program&lt;/font&gt;&lt;/h2&gt; &lt;p&gt; Create the following simple program and save it as &lt;i&gt;HelloWorld.java&lt;/i&gt; in a sub folder &lt;i&gt;src&lt;/i&gt;: &lt;/p&gt; &lt;pre&gt;public class HelloWorld {&lt;br&gt;    public static void main(String[] args) {&lt;br&gt;        System.out.println(&amp;quot;Hello World&amp;quot;);&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;h2&gt;&lt;font size="4"&gt;Ant Script&lt;/font&gt;&lt;/h2&gt; &lt;p&gt; Use a text editor to create a file called &lt;i&gt;build.xml&lt;/i&gt; and place it in the main folder: &lt;/p&gt; &lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br&gt;&amp;lt;project name=&amp;quot;Run Test&amp;quot; default=&amp;quot;run&amp;quot; basedir=&amp;quot;.&amp;quot;&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;clean&amp;quot;&amp;gt;         &amp;lt;delete dir=&amp;quot;build&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;compile&amp;quot; depends=&amp;quot;clean&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;mkdir dir=&amp;quot;build/classes&amp;quot;/&amp;gt;&lt;br&gt;        &amp;lt;javac srcdir=&amp;quot;src&amp;quot; destdir=&amp;quot;build/classes&amp;quot;/&amp;gt;     &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;jar&amp;quot; depends=&amp;quot;compile&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;mkdir dir=&amp;quot;build/jar&amp;quot;/&amp;gt;&lt;br&gt;        &amp;lt;jar destfile=&amp;quot;build/jar/HelloWorld.jar&amp;quot; &lt;br&gt;                basedir=&amp;quot;build/classes&amp;quot;&amp;gt;             &amp;lt;manifest&amp;gt;&lt;br&gt;                &amp;lt;attribute name=&amp;quot;Main-Class&amp;quot; value=&amp;quot;HelloWorld&amp;quot;/&amp;gt;&lt;br&gt;            &amp;lt;/manifest&amp;gt;&lt;br&gt;        &amp;lt;/jar&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;run&amp;quot; depends=&amp;quot;jar&amp;quot;&amp;gt;         &amp;lt;java jar=&amp;quot;build/jar/HelloWorld.jar&amp;quot; fork=&amp;quot;true&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;/project&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;h2&gt;&lt;font size="4"&gt;Output&lt;/font&gt;&lt;/h2&gt; &lt;p&gt; Run &lt;i&gt;ant&lt;/i&gt; in command line: &lt;/p&gt; &lt;pre&gt;[root@nimal ant-hw]# ant&lt;br&gt;Buildfile: build.xml&lt;br&gt;&lt;br&gt;clean:&lt;br&gt;   [delete] Deleting directory /opt/ant-hw/build&lt;br&gt;&lt;br&gt;compile:&lt;br&gt;    [mkdir] Created dir: /opt/ant-hw/build/classes&lt;br&gt;    [javac] Warning: HelloWorld.java modified in the future.     [javac] Compiling 1 source file to /opt/ant-hw/build/classes&lt;br&gt;&lt;br&gt;jar:&lt;br&gt;    [mkdir] Created dir: /opt/ant-hw/build/jar&lt;br&gt;    [jar] Building jar: /opt/ant-hw/build/jar/HelloWorld.jar&lt;br&gt;&lt;br&gt;run:&lt;br&gt;     [java] Hello World &lt;br&gt;BUILD SUCCESSFUL&lt;br&gt;Total time: 4 seconds&lt;br&gt;&lt;/pre&gt;&lt;h2&gt;&lt;font size="4"&gt;Enhance the build file&lt;/font&gt;&lt;/h2&gt; &lt;p&gt; Now we have a working buildfile we could do some enhancements: many time you are referencing the same directories, main-class and jar-name are hard coded, and while invocation you have to remember the right order of build steps. &lt;/p&gt; &lt;pre&gt;&amp;lt;project name=&amp;quot;HelloWorld&amp;quot; basedir=&amp;quot;.&amp;quot; default=&amp;quot;main&amp;quot;&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;property name=&amp;quot;src.dir&amp;quot;     value=&amp;quot;src&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;property name=&amp;quot;build.dir&amp;quot;   value=&amp;quot;build&amp;quot;/&amp;gt;&lt;br&gt;      &amp;lt;property name=&amp;quot;classes.dir&amp;quot; value=&amp;quot;${build.dir}/classes&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;property name=&amp;quot;jar.dir&amp;quot;     value=&amp;quot;${build.dir}/jar&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;property name=&amp;quot;main-class&amp;quot;  value=&amp;quot;HelloWorld&amp;quot;/&amp;gt; &lt;br&gt;    &amp;lt;target name=&amp;quot;clean&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;delete dir=&amp;quot;${build.dir}&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;compile&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;mkdir dir=&amp;quot;${classes.dir}&amp;quot;/&amp;gt;         &amp;lt;javac srcdir=&amp;quot;${src.dir}&amp;quot; destdir=&amp;quot;${classes.dir}&amp;quot;/&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;jar&amp;quot; depends=&amp;quot;compile&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;mkdir dir=&amp;quot;${jar.dir}&amp;quot;/&amp;gt;&lt;br&gt;         &amp;lt;jar destfile=&amp;quot;${jar.dir}/${&lt;a href="http://ant.project.name"&gt;ant.project.name&lt;/a&gt;}.jar&amp;quot; &lt;br&gt;                basedir=&amp;quot;${classes.dir}&amp;quot;&amp;gt;&lt;br&gt;            &amp;lt;manifest&amp;gt;&lt;br&gt;                &amp;lt;attribute name=&amp;quot;Main-Class&amp;quot; value=&amp;quot;${main-class}&amp;quot;/&amp;gt;             &amp;lt;/manifest&amp;gt;&lt;br&gt;        &amp;lt;/jar&amp;gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;run&amp;quot; depends=&amp;quot;jar&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;java jar=&amp;quot;${jar.dir}/${&lt;a href="http://ant.project.name"&gt;ant.project.name&lt;/a&gt;}.jar&amp;quot; fork=&amp;quot;true&amp;quot;/&amp;gt;     &amp;lt;/target&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;clean-build&amp;quot; depends=&amp;quot;clean,jar&amp;quot;/&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;main&amp;quot; depends=&amp;quot;clean,run&amp;quot;/&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;/project&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;      &lt;/div&gt;                        &lt;input name="action" value="edit" type="hidden"&gt;       Feedback and questions are welcome via comment or you can email me at &lt;tt&gt;talkout&amp;nbsp;AT&amp;nbsp;SPAMFREE&amp;nbsp;gmail&amp;nbsp;DOT&amp;nbsp;com&lt;/tt&gt;&lt;br clear="all"&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-3756413999058663370?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/3756413999058663370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=3756413999058663370' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/3756413999058663370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/3756413999058663370'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/02/ant-java-hello-world-in-ant.html' title='Ant: Java Hello World in Ant'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-6384880662833645662</id><published>2008-02-23T21:33:00.001-08:00</published><updated>2008-02-27T01:16:05.927-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ant'/><title type='text'>Ant: Installation</title><content type='html'>As I have worked on Ant before sometime for a project and I had few of my own documents for reference, related to installing and using &lt;a href="http://en.wikipedia.org/wiki/Apache_Ant" target="_blank"&gt;Apache Ant&lt;/a&gt;. I thought of sharing those via this blog as it might be useful to someone out there, &lt;i&gt;or at-least would be a backup of my doc in the Blogger servers&lt;/i&gt;. ;)&lt;br&gt; &lt;br&gt;In this series of Ant, I put and &lt;i&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html"&gt;introductory post&lt;/a&gt;&lt;/i&gt; which is followed by a &lt;i&gt;&lt;a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html"&gt;Hello World post&lt;/a&gt;&lt;/i&gt;, and then I got a couple of IMs asking how could one come to &lt;i&gt;Hello World&lt;/i&gt; before an installation post.&lt;i&gt; (Seems thats the standard way of tutorial, so I said I&amp;#39;m not writing any tutorials, but thought of posting this now... &lt;/i&gt;:) ... &lt;i&gt;). &lt;/i&gt;&lt;br&gt; &lt;b&gt; &lt;br&gt;System Requirements for Ant&lt;/b&gt; &lt;p&gt; Ant has been used successfully on many platforms, including Linux, MacOS X, Windows XP and Unix. To build and use Ant, you must have a JAXP-compliant XML parser installed and available on your classpath, such as &lt;a href="http://en.wikipedia.org/wiki/Xerces"&gt;Xerces&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Note: I did this installation on a HP server running &lt;a href="http://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux"&gt;Red Hat Enterprise Linux WS Version 4 Update 4&lt;/a&gt;.&lt;br&gt;  &lt;/p&gt; &lt;p&gt;For the current version of Ant, you will also need a JDK installed on your system, version 1.2 or later required, 1.5 or later strongly recommended. The later the version of Java, the more Ant tasks you get. &lt;/p&gt; &lt;p&gt; Note: If a &lt;a href="http://en.wikipedia.org/wiki/JDK"&gt;JDK&lt;/a&gt; is not present, only the &lt;a href="http://en.wikipedia.org/wiki/JRE"&gt;JRE&lt;/a&gt; runtime, then many tasks will not work.&lt;/p&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;font size="4"&gt;Building Ant&lt;/font&gt;&lt;/h2&gt;  &lt;h3 style="font-weight: normal;"&gt;&lt;u&gt;&lt;b&gt;&lt;font size="2"&gt;Obtaining Ant&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt; To build Ant from source, you can either install the &lt;a href="http://ant.apache.org/srcdownload.cgi" target="_blank"&gt;&lt;span&gt;Ant source distribution&lt;/span&gt;&lt;/a&gt; or checkout the Ant module from SVN. I obtained the Ant source version and placed it at &lt;i&gt;/opt/&lt;/i&gt; &lt;/p&gt; &lt;p&gt; Once you have obtained the source, change into the installation directory and run, &lt;/p&gt; &lt;pre&gt;[root@nimal opt]# tar -xzvf apache-ant-1.7.0-src.tar.gz&lt;br&gt;&lt;/pre&gt;&lt;p&gt;This will creat Set the JAVA_HOME environment variable to the directory where the JDK is installed. See Installing Ant for examples on how to do this for your operating system. &lt;/p&gt; &lt;p&gt; Note: The bootstrap process of Ant requires a greedy compiler like Sun&amp;#39;s javac or jikes. It does not work with gcj or kjc. &lt;/p&gt; &lt;p&gt;Make sure you have downloaded any auxiliary jars required to build tasks you are interested in. These should be added to the lib/optional directory of the source tree. See Library Dependencies for a list of JAR requirements for various features. Note that this will make the auxiliary JAR available for the building of Ant only. For running Ant you will still need to make the JARs available as described under Installing Ant. &lt;/p&gt; &lt;p&gt; In our case we need the &lt;a href="http://www.junit.org/" target="_blank"&gt;&lt;span&gt;JUnit jar&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://xportal.wavenet.lk:8020/trac/general/qa/browser/sandbox/nimalaprakasan/Software/ant/junit.jar" target="_blank"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3&gt;&lt;u&gt;&lt;font size="2"&gt;Environment Settings&lt;/font&gt;&lt;/u&gt;&lt;/h3&gt; &lt;h4&gt;&lt;i&gt;&lt;font size="2"&gt;Linux/Unix (bash)&lt;/font&gt;&lt;/i&gt;&lt;/h4&gt; &lt;p&gt; Assume Ant is installed in /usr/local/ant. The following sets up the environment: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt; export ANT_HOME=/usr/local/ant export JAVA_HOME=/usr/java/jdk1.6.0/ export PATH=${PATH}:${ANT_HOME}/bin &lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt; The above can be set by editing the &lt;i&gt;.bashrc&lt;/i&gt; file. &lt;/p&gt; &lt;pre&gt;[root@nimal ~]# vi ~/.&lt;br&gt;&lt;/pre&gt;&lt;p&gt; Once this file is opened it will look like this. &lt;/p&gt; &lt;pre&gt;# .bashrc&lt;br&gt;&lt;br&gt;# User specific aliases and functions&lt;br&gt;&lt;br&gt;alias rm=&amp;#39;rm -i&amp;#39;&lt;br&gt;alias cp=&amp;#39;cp -i&amp;#39;&lt;br&gt;alias mv=&amp;#39;mv -i&amp;#39;&lt;br&gt;&lt;br&gt;# Source global definitions&lt;br&gt;if [ -f /etc/bashrc ]; then&lt;br&gt;         . /etc/bashrc&lt;br&gt;fi&lt;br&gt;&lt;/pre&gt;&lt;p&gt; Append these lines below the end of the if clause below &lt;i&gt;fi&lt;/i&gt; &lt;/p&gt; &lt;pre&gt;export ANT_HOME=/usr/local/ant/&lt;br&gt;export JAVA_HOME=/usr/java/jdk1.6.0/&lt;br&gt;export PATH=${PATH}:${ANT_HOME}/bin&lt;br&gt;&lt;/pre&gt;&lt;p&gt; And the final file should look like this; save and close the file. &lt;/p&gt; &lt;pre&gt;# .bashrc&lt;br&gt;&lt;br&gt;# User specific aliases and functions&lt;br&gt;&lt;br&gt;alias rm=&amp;#39;rm -i&amp;#39;&lt;br&gt;alias cp=&amp;#39;cp -i&amp;#39;&lt;br&gt;alias mv=&amp;#39;mv -i&amp;#39;&lt;br&gt;&lt;br&gt;# Source global definitions&lt;br&gt;if [ -f /etc/bashrc ]; then&lt;br&gt;         . /etc/bashrc&lt;br&gt;fi&lt;br&gt;&lt;br&gt;export ANT_HOME=/usr/local/ant/&lt;br&gt;export JAVA_HOME=/usr/java/jdk1.6.0/&lt;br&gt;export PATH=${PATH}:${ANT_HOME}/bin&lt;br&gt;&lt;/pre&gt;&lt;font size="4"&gt;Normal build and install&lt;/font&gt; &lt;p&gt; Your are now ready to build Ant: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt; build -Ddist.dir=&amp;lt;directory_to_contain_Ant_distribution&amp;gt; dist    (Windows) sh build.sh -Ddist.dir=&amp;lt;directory_to_contain_Ant_distribution&amp;gt; dist    (Unix) &lt;/p&gt; &lt;/blockquote&gt; &lt;pre&gt;[root@nimal opt]# cd /opt/apache-ant-1.7.0/&lt;br&gt;[root@nimal apache-ant-1.7.0]# sh build.sh -Ddist.dir=/usr/local/ant/ dist&lt;br&gt;Buildfile: build.xml&lt;br&gt;&lt;br&gt;dist:&lt;br&gt;&lt;br&gt;prepare:&lt;br&gt;&lt;br&gt;check_for_optional_packages:&lt;br&gt; &lt;br&gt;build:&lt;br&gt;     [copy] Copying 2 files to /opt/apache-ant-1.7.0/build/classes&lt;br&gt;&lt;br&gt;jars:&lt;br&gt;      [jar] Building jar: /opt/apache-ant-1.7.0/build/lib/ant.jar&lt;br&gt;&lt;br&gt;      .&lt;br&gt;      .&lt;br&gt;      .&lt;br&gt;&lt;br&gt;compile-tests:&lt;br&gt;  &lt;br&gt;test-jar:&lt;br&gt;&lt;br&gt;dist-lite:&lt;br&gt;    [mkdir] Created dir: /usr/local/ant&lt;br&gt;    [mkdir] Created dir: /usr/local/ant/bin&lt;br&gt;    [mkdir] Created dir: /usr/local/ant/lib&lt;br&gt;     [copy] Copying 8 files to /usr/local/ant/lib&lt;br&gt;       [copy] Copying 2 files to /usr/local/ant/lib&lt;br&gt;     [copy] Copying 13 files to /usr/local/ant/bin&lt;br&gt;&lt;br&gt;javadoc_check:&lt;br&gt;&lt;br&gt;javadocs:&lt;br&gt;    [mkdir] Created dir: /opt/apache-ant-1.7.0/build/javadocs&lt;br&gt;  [javadoc] Generating Javadoc&lt;br&gt;  &lt;br&gt;  .&lt;br&gt;  .&lt;br&gt;  .&lt;br&gt;&lt;br&gt;  [javadoc] 114 warnings&lt;br&gt;&lt;br&gt;dist_javadocs:&lt;br&gt;    [mkdir] Created dir: /usr/local/ant/docs/manual/api&lt;br&gt;     [copy] Copying 1180 files to /usr/local/ant/docs/manual/api&lt;br&gt;&lt;br&gt;internal_dist:&lt;br&gt;      [mkdir] Created dir: /usr/local/ant/etc&lt;br&gt;     [copy] Copying 1 file to /usr/local/ant/lib&lt;br&gt;     [copy] Copying 1 file to /usr/local/ant/lib&lt;br&gt;     [copy] Copying 25 files to /usr/local/ant/lib&lt;br&gt;     [copy] Copying 1 file to /usr/local/ant/lib&lt;br&gt;       [copy] Copying 259 files to /usr/local/ant/docs&lt;br&gt;     [copy] Copying 33 files to /usr/local/ant/docs&lt;br&gt;     [copy] Copying 11 files to /usr/local/ant&lt;br&gt;     [copy] Copying 15 files to /usr/local/ant/etc&lt;br&gt;&lt;br&gt;BUILD SUCCESSFUL&lt;br&gt;  Total time: 59 seconds&lt;br&gt;&lt;/pre&gt;&lt;p&gt; This will create a binary distribution of Ant in the directory you specified. &lt;/p&gt; &lt;p&gt; The above action does the following: &lt;/p&gt; &lt;ul&gt;&lt;li&gt;If necessary it will bootstrap the Ant code. Bootstrapping involves the manual compilation of enough Ant code to be able to run Ant. The bootstrapped Ant is used for the remainder of the build steps. &lt;/li&gt;&lt;li&gt;Invokes the bootstrapped Ant with the parameters passed to the build script. In this case, these parameters define an Ant property value and specify the &amp;quot;dist&amp;quot; target in Ant&amp;#39;s own build.xml file. &lt;/li&gt;&lt;li&gt;Create the ant.jar and ant-launcher.jar JAR files &lt;/li&gt;&lt;li&gt;Create optional JARs for which the build had the relevant libraries. If a particular library is missing from ANT_HOME/lib/optional, then the matching ant- JAR file will not be created. For example, ant-junit.jar is only built if there is a junit.jar in the optional directory. &lt;/li&gt;&lt;/ul&gt;&lt;h3 style="font-weight: normal;"&gt;&lt;font size="4"&gt;Other ways to build and install&lt;/font&gt;&lt;/h3&gt; &lt;p&gt;On most occasions you will not need to explicitly bootstrap Ant since the build scripts do that for you. If however, the build file you are using makes use of features not yet compiled into the bootstrapped Ant, you will need to manually bootstrap. Run bootstrap.bat (Windows) or bootstrap.sh (UNIX) to build a new bootstrap version of Ant. If you wish to install the build into the current ANT_HOME directory, you can use: &lt;/p&gt; &lt;pre&gt;    build install    (Windows)&lt;br&gt;    sh build.sh install    (Unix)&lt;br&gt;&lt;/pre&gt;&lt;p&gt; You can avoid the lengthy Javadoc step, if desired, with: &lt;/p&gt; &lt;pre&gt;    build install-lite    (Windows)&lt;br&gt;    sh build.sh install-lite    (Unix)&lt;br&gt;&lt;/pre&gt;&lt;p&gt; This will only install the bin and lib directories. &lt;/p&gt; &lt;p&gt; Both the install and install-lite targets will overwrite the current Ant version in ANT_HOME. &lt;/p&gt;&lt;font size="4"&gt;Checking the Installation&lt;/font&gt; &lt;p&gt; Now we have built and installed Ant, and we can check if everything works properly, as shown below. &lt;/p&gt; &lt;pre&gt;[root@nimal ~]# which ant&lt;br&gt;/usr/local/ant/bin/ant&lt;br&gt;[root@nimal ~]# ant -version&lt;br&gt;Apache Ant version 1.7.0 compiled on November 13 2007&lt;br&gt;&lt;/pre&gt;                            &lt;input name="action" value="edit" type="hidden"&gt;       This is just a brief document related to Ant installation which I did on a RHEL4 server. I think this should work on other environments as well, but I&amp;#39;m not sure about that. If someone of you try this using my doc and if you are successful just let me know via a comment. Also if you have any doubts you can ask me, but I can assure answers, if-and-only-if its under my intellectual capacity :).&lt;br&gt; &lt;br&gt;Reference: &lt;a href="http://ant.apache.org/manual/install.html"&gt;http://ant.apache.org/manual/install.html&lt;/a&gt;&lt;br&gt; &amp;nbsp;&lt;br clear="all"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-6384880662833645662?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/6384880662833645662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=6384880662833645662' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6384880662833645662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/6384880662833645662'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/02/ant-installation.html' title='Ant: Installation'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-7223844165730396958</id><published>2008-02-18T05:16:00.001-08:00</published><updated>2008-02-27T01:16:05.927-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ant'/><title type='text'>Ant: Hello World in Ant</title><content type='html'>&lt;div&gt;&lt;div&gt;This is a simple reference of my, which might be helpful to someone after installing &lt;a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html"&gt;Ant&lt;/a&gt; and do some playing.&lt;br&gt;&lt;br&gt;Use a text editor to create a file called &lt;i&gt;build.xml&lt;/i&gt;:  &lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br&gt;&amp;lt;project name=&amp;quot;My Project&amp;quot; default=&amp;quot;hello&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;target name=&amp;quot;hello&amp;quot;&amp;gt;&lt;br&gt;       &amp;lt;echo&amp;gt;Hello World!&amp;lt;/echo&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;/target&amp;gt;&lt;br&gt;  &amp;lt;/project&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;p&gt; The first line in the file tells the system that this is an XML file. The next line tells ant that we have a project named &amp;quot;My Project&amp;quot; and that it has a default target called &amp;quot;hello&amp;quot;. Note that the file must always start with a &amp;lt;project&amp;gt; and end with a &amp;lt;/project&amp;gt;. The central three lines are the one and only target in the file. They give the target a name and the target has just one task called &amp;quot;echo&amp;quot; &lt;/p&gt; &lt;p&gt; You can now open a shell and type &amp;quot;ant&amp;quot;. The default task is a required attribute of the project. Each target must have a name. &lt;/p&gt; &lt;h2&gt;&lt;u&gt;&lt;font size="2"&gt;Output of Hello World&lt;/font&gt;&lt;/u&gt;&lt;/h2&gt; &lt;pre&gt;[root@nimal ant-tests]# ant&lt;br&gt;Buildfile: build.xml&lt;br&gt;&lt;br&gt;hello:&lt;br&gt;     [echo] Hello World!&lt;br&gt;&lt;br&gt;BUILD SUCCESSFUL&lt;br&gt;Total time: 1 second&lt;br&gt;[root@nimal ant-tests]# &lt;br&gt;&lt;/pre&gt;&lt;h2&gt;&lt;u&gt;&lt;font size="2"&gt;Variations&lt;/font&gt;&lt;/u&gt;&lt;/h2&gt;  &lt;p&gt; The following variations of &lt;i&gt;echo&lt;/i&gt; will also give similar output. &lt;/p&gt; &lt;pre&gt;&amp;lt;echo message=&amp;quot;Hello There!&amp;quot;&amp;gt;&amp;lt;/echo&amp;gt;&lt;br&gt;&amp;lt;echo message=&amp;quot;Hello There!&amp;quot;/&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;&lt;br clear="all"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-7223844165730396958?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/7223844165730396958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=7223844165730396958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/7223844165730396958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/7223844165730396958'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/02/ant-hello-world-in-ant.html' title='Ant: Hello World in Ant'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-4176703700937302096</id><published>2008-01-26T09:41:00.001-08:00</published><updated>2008-02-27T01:16:05.928-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ant'/><title type='text'>Apache Ant</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://ant.apache.org/images/group-logo.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px;" src="http://ant.apache.org/images/group-logo.gif" alt="" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;&lt;/span&gt;&lt;div class="gmail_quote"&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:100%;" &gt;What is Apache Ant?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Apache Ant (or simply Ant) is an XML-based build scripting language used heavily by the Open Source community. This is specially handy when it come is to automating the build process. Also Ant is infamous for its good going with Java projects, though it is very much capable of doing various other stuff.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Apache Ant:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;An operating system and language neutral XML based "Build Tool"&lt;/li&gt;&lt;li&gt;A scripting language for executing any complex file-system processes that can be run from a command line interface&lt;/li&gt;&lt;li&gt;A.N.T. – Another Neat Tool&lt;/li&gt;&lt;li&gt;User for Building the Project &lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Ant Terminology&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Ant Project – a collection of named targets that can run in any order depending on the time stamps of the files in the file system. Each build file contains one project.&lt;/li&gt;&lt;li&gt;Ant Target – a fixed series of ant tasks in a specified order that can depend on other named targets. Targets can depend only on other targets, not on projects or tasks.&lt;/li&gt;&lt;li&gt;Ant Task – something that ant can execute such as a compile, copy or replace. Most tasks have very convenient default values. See the Ant manual for a complete list of tasks. &lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Links&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is lot more to read and learn about Ant and even I don't know much about it except to my using it for a build automation project. So it'll be best to read from some external resources to get a better idea about it.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Apache_Ant"&gt;Wikipedia&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikibooks.org/wiki/Apache_Ant"&gt;Wikibooks&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Happy Building with Apache Ant...!&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-4176703700937302096?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/4176703700937302096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=4176703700937302096' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/4176703700937302096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/4176703700937302096'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/01/apache-ant.html' title='Apache Ant'/><author><name>NiMaL-நிமல்</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://en.gravatar.com/avatar/c9ef15d20551d91a1d92279d6d4ffd49?s=80&amp;r=any'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250146174432122339.post-4472483453582330177</id><published>2008-01-26T01:30:00.000-08:00</published><updated>2008-12-09T21:45:48.559-08:00</updated><title type='text'>Another  Beginning : Sharing Your Knowlegde</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Hi Friend, In these modern age, knowlege is the wealth. We meet many persons who are expertise in many fields. They have all the knowledge about it. But not only them, others also may need that knowledge for their works. If one person work in his field for a long time, he get much more knowlegde, new ways and means about doing things, and many more things. You know sharing is a good habit. Then for who knows , who expertise in some technology or field, the best thing he can do is share that knowlegde with all others who don't know about them. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;So I thought to start another tech blog for sharing our knowledge, experiences about what we know, what we are familiar with. For anyone who is interested in sharing his/her knowledge can blog in this site. ( Actually, before blogging send me a email mentioning your mail address with a description about you, so i can add you as a blogger in this site. or add a comment to this post mentioning your mail address with a description about you.)&lt;/span&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;span style="font-size:85%;color:#6600cc;"&gt;Hey, why you just only reading? Start to share your knowledge in here from this moment.&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;PS: You not need to be a expert in the field you blogging about, You can share what you know. :)&lt;a href="http://3.bp.blogspot.com/_PcpMyt9rclU/R5sCTmqPcEI/AAAAAAAAAAM/X0CTlfoupsk/s1600-h/image004.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5159720333901525058" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_PcpMyt9rclU/R5sCTmqPcEI/AAAAAAAAAAM/X0CTlfoupsk/s320/image004.gif" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5250146174432122339-4472483453582330177?l=shareyourknowlege.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shareyourknowlege.blogspot.com/feeds/4472483453582330177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5250146174432122339&amp;postID=4472483453582330177' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/4472483453582330177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250146174432122339/posts/default/4472483453582330177'/><link rel='alternate' type='text/html' href='http://shareyourknowlege.blogspot.com/2008/01/another-beginning-sharing-your.html' title='Another  Beginning : Sharing Your Knowlegde'/><author><name>SiLver Surfer</name><uri>http://www.blogger.com/profile/03243111172825129435</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp2.blogger.com/_PcpMyt9rclU/R9JcdDSi9CI/AAAAAAAAAAk/o_InREIUi3w/S220/images.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_PcpMyt9rclU/R5sCTmqPcEI/AAAAAAAAAAM/X0CTlfoupsk/s72-c/image004.gif' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
