<?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-6598708119236548396</id><updated>2024-08-28T00:49:08.725-07:00</updated><category term="JAVA"/><category term="1.6.0_17"/><category term="Ant"/><category term="Error 1606"/><category term="HTML color code notation"/><category term="JDK 6"/><category term="Method"/><category term="OS"/><category term="Sun"/><category term="Vista"/><category term="Windows"/><category term="bat"/><category term="batch"/><category term="check"/><category term="condition"/><category term="exec"/><category term="execute"/><category term="family"/><category term="hexadecimal"/><category term="install"/><category term="overload"/><category term="overloading"/><category term="parameter"/><category term="polymorphism"/><category term="return"/><category term="scripts"/><category term="sh"/><category term="shell"/><category term="task"/><category term="update 17"/><title type='text'>In the world of Java!</title><subtitle type='html'>Sharing...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://intheworldofjava.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://intheworldofjava.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>FromTheFrigidZone</name><uri>http://www.blogger.com/profile/01314182272748675655</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>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6598708119236548396.post-2870147756266955293</id><published>2010-07-28T13:09:00.000-07:00</published><updated>2010-07-28T13:12:42.889-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hexadecimal"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML color code notation"/><title type='text'>What is HTML color code notation?</title><content type='html'>It is the format to specify colors in HTML documents, and is hexadecimal notation.&lt;br /&gt;
Six characters from hexadecimal digits (0-F) are used with each pair from left to right representing Red, Green and Blue (RGB) color values.&lt;br /&gt;
Example:&lt;br /&gt;
For color &quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;gray&lt;/span&gt;&quot;, the code is: #808080</content><link rel='replies' type='application/atom+xml' href='http://intheworldofjava.blogspot.com/feeds/2870147756266955293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intheworldofjava.blogspot.com/2010/07/what-is-html-color-code-notation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/2870147756266955293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/2870147756266955293'/><link rel='alternate' type='text/html' href='http://intheworldofjava.blogspot.com/2010/07/what-is-html-color-code-notation.html' title='What is HTML color code notation?'/><author><name>FromTheFrigidZone</name><uri>http://www.blogger.com/profile/01314182272748675655</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-6598708119236548396.post-914610029318472248</id><published>2010-04-23T13:13:00.000-07:00</published><updated>2010-04-23T13:13:22.045-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Method"/><category scheme="http://www.blogger.com/atom/ns#" term="overload"/><category scheme="http://www.blogger.com/atom/ns#" term="overloading"/><category scheme="http://www.blogger.com/atom/ns#" term="parameter"/><category scheme="http://www.blogger.com/atom/ns#" term="polymorphism"/><category scheme="http://www.blogger.com/atom/ns#" term="return"/><title type='text'>Method Overloading In JAVA</title><content type='html'>In &lt;a href=&quot;http://www.amazon.com/Java-Nutshell-5th-David-Flanagan/dp/0596007736?ie=UTF8&amp;amp;tag=inthe-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969&quot; target=&quot;_blank&quot;&gt;JAVA&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://www.assoc-amazon.com/e/ir?t=inthe-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596007736&quot; style=&quot;border: medium none ! important; margin: 0px ! important; padding: 0px ! important;&quot; width=&quot;1&quot; /&gt;, it is legal to define &lt;b&gt;two or more methods&lt;/b&gt; with the &lt;b&gt;&lt;u&gt;same name&lt;/u&gt; within the same class provided their parameters declarations are different&lt;/b&gt;. The methods are said to be &lt;b&gt;&lt;u&gt;overloaded&lt;/u&gt;&lt;/b&gt;, and the process is called &lt;b&gt;&lt;u&gt;method overloading&lt;/u&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;By now, you must be thinking about “&lt;b&gt;polymorphism&lt;/b&gt;”, isn’t it? That is one interface, but many methods.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Based on the &lt;b&gt;&lt;u&gt;parameter-type and number of parameters&lt;/u&gt;&lt;/b&gt;, the &lt;a href=&quot;http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060?ie=UTF8&amp;amp;tag=inthe-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969&quot; target=&quot;_blank&quot;&gt;JAVA &lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://www.assoc-amazon.com/e/ir?t=inthe-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0071591060&quot; style=&quot;border: medium none ! important; margin: 0px ! important; padding: 0px ! important;&quot; width=&quot;1&quot; /&gt;knows which method to invoke during a function call.&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Here’s a sample program to demo method overloading:&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;//MethodOverloadingDemo&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;public class MethodOverloadDemo{&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;private void &lt;b&gt;evaluate&lt;/b&gt;(){&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;//method with zero parameters&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;System.out.println(“evaluate: No parameters);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;//overload &lt;b&gt;evaluate&lt;/b&gt; with one integer parameter and return it.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;private int &lt;b&gt;evaluate&lt;/b&gt;(int oneParam){&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;//method with one &amp;nbsp;parameters&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;System.out.println(“evaluate: one int param: “ + oneParam);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;return oneParam;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;//Overload evaluate to add two integers and return their sum&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;private int &lt;b&gt;evaluate&lt;/b&gt;(int param1, int param2){&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;//method with two parameters&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;System.out.println(“evaluate: (param1” + param1+ “ + param2” +param2+ “)=” + param1+ param2);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;return (param1 + param2);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;//Overload evaluate to multiply two doubles and return their product&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;private double &lt;b&gt;evaluate&lt;/b&gt;(double param1, double param2){&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;//method with two parameters&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;System.out.println(“evaluate: &amp;nbsp;(param1” + param1+ “ * param2” +param2+ “)=” + param1* param2);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;return (param1 * param2);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;NOTE&lt;/b&gt;: As seen in above example, the &lt;b&gt;&lt;u&gt;return type&lt;/u&gt;&lt;/b&gt; of overloaded methods can also be different.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Let’s see above call in action.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;public class TestOverloadedDemo{&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main (String args[]){&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MethodOverloadDemo mod = new MethodOverloadDemo();&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;//test overloaded methods&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mod.evaluate();&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mod.evaluate(10);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int intResult = mod(5 + 15);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(“Sum of two int params: ” + intResult);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double doubleResult = mod(11.24 * 34.23);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(“Product of two double params: ” + doubleResult);&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;//output&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;evaluate: No parameters&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;evaluate: one int param: 10&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;evaluate: (5 + 15) = 20&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Sum of two int params: 20&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;evaluate: &amp;nbsp;(11.24 * 34.23) = 384.7452&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Product of two double params: 384.7452&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Hope this simple explanation helps. Good Luck!&lt;/div&gt;&lt;br /&gt;
&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://intheworldofjava.blogspot.com/feeds/914610029318472248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intheworldofjava.blogspot.com/2010/04/method-overloading-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/914610029318472248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/914610029318472248'/><link rel='alternate' type='text/html' href='http://intheworldofjava.blogspot.com/2010/04/method-overloading-in-java.html' title='Method Overloading In JAVA'/><author><name>FromTheFrigidZone</name><uri>http://www.blogger.com/profile/01314182272748675655</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-6598708119236548396.post-3511738347730077084</id><published>2010-04-21T10:29:00.000-07:00</published><updated>2010-04-21T10:29:19.544-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ant"/><category scheme="http://www.blogger.com/atom/ns#" term="bat"/><category scheme="http://www.blogger.com/atom/ns#" term="batch"/><category scheme="http://www.blogger.com/atom/ns#" term="check"/><category scheme="http://www.blogger.com/atom/ns#" term="condition"/><category scheme="http://www.blogger.com/atom/ns#" term="exec"/><category scheme="http://www.blogger.com/atom/ns#" term="execute"/><category scheme="http://www.blogger.com/atom/ns#" term="family"/><category scheme="http://www.blogger.com/atom/ns#" term="OS"/><category scheme="http://www.blogger.com/atom/ns#" term="scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="sh"/><category scheme="http://www.blogger.com/atom/ns#" term="shell"/><category scheme="http://www.blogger.com/atom/ns#" term="task"/><title type='text'>Ant task to check for OS before executing a batch (.bat) or shell (.sh) script</title><content type='html'>Suppose we have two scripts - one (&lt;b&gt;.bat&lt;/b&gt; file) executes on &lt;b&gt;windows&lt;/b&gt; os family, and other (&lt;b&gt;.sh&lt;/b&gt;) thats runs on all &lt;b&gt;non-windows&lt;/b&gt; platforms like unix, linux, etc. And, we need an &lt;b&gt;ant task&lt;/b&gt; in build file, to call the appropriate scripts depending on the operating system.&lt;br /&gt;
&lt;br /&gt;
Lets call this ant task &quot;run.script&quot;, and this depends on whether OS family is windows or not windows.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&amp;lt;target depends=&quot;ifWindows, ifNotWindows&quot; name=&quot;run.script&quot;/&amp;gt;&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
This is no brainer - we are just saying that &quot;run.script&quot; task depends on tasks called &quot;ifWindows&quot; and &quot;ifNotWindows&quot;. We then define these two tasks as below:&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;code&gt;&amp;lt;target name=&quot;&lt;b&gt;ifWindows&lt;/b&gt;&quot;&lt;span style=&quot;color: #990000;&quot;&gt; if&lt;/span&gt;=&quot;&lt;b&gt;is-windows&lt;/b&gt;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;antcall target=&quot;run.script.windows&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&amp;lt;target name=&quot;&amp;lt;b&quot;&amp;gt;&quot;ifNotWindows&quot;&lt;span style=&quot;color: #990000;&quot;&gt; if&lt;/span&gt;=&quot;&lt;b&gt;is-unix&lt;/b&gt;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;antcall target=&quot;run.script.unix&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
As we see, ifWindows and ifNotWindows task are based on a &lt;b&gt;condition&lt;/b&gt;, which if true calls the specific target.&lt;br /&gt;
&lt;br /&gt;
If &lt;span style=&quot;background-color: white;&quot;&gt;&quot;&lt;span style=&quot;color: #990000;&quot;&gt;is-windows&lt;/span&gt;&quot; &lt;/span&gt;property, defind as -&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&amp;lt;condition property=&quot;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;b style=&quot;color: #990000;&quot;&gt;is-windows&lt;/b&gt;&lt;/span&gt;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;os family=&quot;windows&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/condition&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
returns true, than ant target &quot;run.script.windows&quot; is executed.&lt;br /&gt;
&lt;br /&gt;
Else, ifNotWindows tested using &quot;&lt;span style=&quot;color: #990000;&quot;&gt;is-unix&lt;/span&gt;&quot; property: &lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&amp;lt;condition property=&quot;&lt;span style=&quot;color: #990000;&quot;&gt;is-unix&lt;/span&gt;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;not&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;os family=&quot;windows&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/not&amp;gt;&lt;br /&gt;
&amp;lt;/condition&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
If this condition returns true, then &quot;&lt;b&gt;run.script.unix&lt;/b&gt;&quot; will be called.&lt;br /&gt;
&lt;br /&gt;
Following is how you can define&lt;b&gt; an ant task to execute a batch script on windows&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
To execute a script , &lt;b&gt;exec &lt;/b&gt;command is used wrapped inside you target definition:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&amp;lt;target name=&quot;&lt;b&gt;run.script.windows&lt;/b&gt;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;exec dir=&quot;.&quot; executable=&quot;cmd&quot; os=&quot;Windows Vista&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt;&amp;lt;arg line=&quot;/c myScript.bat -p myScriptArg1 myScriptArg2&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/exec&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Following is to &lt;b&gt;run a shell script on unix using Ant task:&lt;/b&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&amp;lt;target name=&quot;&lt;b&gt;&quot;run.script.unix&lt;/b&gt;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;exec dir=&quot;.&quot; executable=&quot;/bin/sh&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;arg line=&quot;-c &quot;myScript.bat -p myScriptArg1 myScriptArg2&quot;&quot;&amp;gt;&lt;br /&gt;
&amp;lt;/exec&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;
1. Note: The double-quotes are nested inside the single-quotes.&lt;br /&gt;
2. Using &quot;&lt;b&gt;arg line&lt;/b&gt;&quot; we are passing the command and command-line parameters to be executed by the shell in one line itself. Alternatively, you may consider using &quot;&lt;b&gt;arg value&lt;/b&gt;&quot; instead.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;To sum up:&lt;/b&gt;&lt;br /&gt;
On systems running a Unix-type shell (for example, Cygwin            on Windows) execute the (command) shell :&lt;br /&gt;
&lt;b&gt;&lt;code&gt;1. sh for&lt;/code&gt;&lt;/b&gt; shell scripts. Use &lt;b&gt;-c switch&lt;/b&gt; to pass the shell script (.sh), any arguments to the script (as needed).&lt;br /&gt;
&lt;b&gt;&lt;code&gt;2. &lt;/code&gt;&lt;code&gt;cmd&lt;/code&gt;&lt;/b&gt;            for batch files. Use&lt;b&gt; /c switch&lt;/b&gt; to pass the batch script (.bat), any arguments to the script (as needed).&lt;br /&gt;
&lt;br /&gt;
&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://intheworldofjava.blogspot.com/feeds/3511738347730077084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intheworldofjava.blogspot.com/2010/04/ant-task-to-check-for-os-before.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/3511738347730077084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/3511738347730077084'/><link rel='alternate' type='text/html' href='http://intheworldofjava.blogspot.com/2010/04/ant-task-to-check-for-os-before.html' title='Ant task to check for OS before executing a batch (.bat) or shell (.sh) script'/><author><name>FromTheFrigidZone</name><uri>http://www.blogger.com/profile/01314182272748675655</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-6598708119236548396.post-3625210735744871738</id><published>2009-12-18T10:03:00.000-08:00</published><updated>2009-12-18T10:13:39.008-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="1.6.0_17"/><category scheme="http://www.blogger.com/atom/ns#" term="Error 1606"/><category scheme="http://www.blogger.com/atom/ns#" term="install"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="JDK 6"/><category scheme="http://www.blogger.com/atom/ns#" term="Sun"/><category scheme="http://www.blogger.com/atom/ns#" term="update 17"/><category scheme="http://www.blogger.com/atom/ns#" term="Vista"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Error 1606 during JDK 6 Update 17 installation on Vista !</title><content type='html'>Hitting error # 1606 on Vista??? &lt;p&gt;P.S: I have my original post on other blog at &lt;a href=&quot;http://urvashimishra.wordpress.com/2009/12/17/error-1606-while-installing-jdk-6-update-17-on-vista/&quot;&gt;wordpress.com&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/span&gt;:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;While installing JDK 6, update 17  ( installation package: jdk-6u17-windows-i586.exe), “error 1606: Could not find network location … %APPDATA%” is thrown. How do I resolve this issue?&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;I  encountered  error 1606 (Could not find network location … %APPDATA%) while installing JDK 6 update 17 on Vista online. Research should that this may be caused due to incorrect registry key settings. Refer &lt;a title=&quot;Microsoft&#39;s Support: Error 1606&quot; href=&quot;http://support.microsoft.com/kb/886549/&quot; target=&quot;_blank&quot;&gt;Microsoft’s Support&lt;/a&gt; to validate your settings.&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt;&lt;p&gt;Despite having correct registry key settings, I was running into this error. After hours of investigation, I could finally do successful installation .&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thanks t&lt;a href=&quot;http://forums.cnet.com/5208-6121_102-0.html?threadID=104829&quot;&gt;o &lt;/a&gt;&lt;a title=&quot;Grif reply&quot; href=&quot;http://forums.cnet.com/5208-6121_102-0.html?threadID=104829&quot; target=&quot;_blank&quot;&gt;Grif Thomas’s reply to a posting in CNet forum&lt;/a&gt; who suggested deleting“Recent” registry key and restarting the machine.&lt;/p&gt; &lt;p&gt;Here’s what you need: (Note: Administrator privileges  may be required for the following)&lt;/p&gt; &lt;p&gt;1. Run regedit.exe (Go to : Start -&gt; Run; enter: regedit.exe) The registry settings will open in a pop up window.&lt;/p&gt; &lt;p&gt;2. Browse to HKEY_CURRENT_USER –&gt; Software&lt;/p&gt; &lt;p&gt;3. Now click on : Microsoft –&gt; Windows&lt;/p&gt; &lt;p&gt;4. Then select: Current Version –&gt; Explorer –&gt; User Shell Folders&lt;/p&gt; &lt;p&gt;5. Right Click on “Recent” key and select “delete”.&lt;/p&gt; &lt;p&gt;6. Restart/reboot the machine.&lt;/p&gt; &lt;p&gt;Remember only on restarting the machine will new registry changes become effective. So first reboot the system and then:&lt;/p&gt; &lt;p&gt;7. run jdk-6u17-windows-i586.exe&lt;/p&gt; &lt;p&gt;Installation should proceed smoothly.&lt;/p&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://intheworldofjava.blogspot.com/feeds/3625210735744871738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intheworldofjava.blogspot.com/2009/12/error-1606-during-jdk-6-update-17.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/3625210735744871738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6598708119236548396/posts/default/3625210735744871738'/><link rel='alternate' type='text/html' href='http://intheworldofjava.blogspot.com/2009/12/error-1606-during-jdk-6-update-17.html' title='Error 1606 during JDK 6 Update 17 installation on Vista !'/><author><name>FromTheFrigidZone</name><uri>http://www.blogger.com/profile/01314182272748675655</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>3</thr:total></entry></feed>