<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SolitaryGeek &#187; Java</title>
	<atom:link href="http://solitarygeek.com/category/java/feed" rel="self" type="application/rss+xml" />
	<link>http://solitarygeek.com</link>
	<description>James Selvakumar&#039;s Blog</description>
	<lastBuildDate>Tue, 21 Dec 2010 04:35:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Wicket: Serving static files</title>
		<link>http://solitarygeek.com/java/wicket-serving-static-files</link>
		<comments>http://solitarygeek.com/java/wicket-serving-static-files#comments</comments>
		<pubDate>Mon, 06 Dec 2010 08:07:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Wicket]]></category>

		<guid isPermaLink="false">http://solitarygeek.com/uncategorized/wicket-serving-static-files</guid>
		<description><![CDATA[<p>I recently came across a situation where I have to serve some static html files in a wicket application. Though it&#8217;s pretty simple, thanks to the ultra easy way wicket offers to write components, things can get tricky especially with the request path.</p> <p>So I thought of documenting this for my own future reference and for the sake of the community.</p> <p>Without wasting time, let me quickly explain how to serve static files with wicket (blatantly copied from wicket-examples).</p> <p>Assumptions</p> <p>I assume that you are using wicket 1.4.x as that&#8217;s the latest stable version at the time of writing this <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/wicket-serving-static-files">Wicket: Serving static files</a></span>]]></description>
			<content:encoded><![CDATA[<p>I recently came across a situation where I have to serve some static html files in a <a href="http://wicket.apache.org">wicket</a> application. Though it&#8217;s pretty simple, thanks to the ultra easy way wicket offers to write components, things can get tricky especially with the request path.</p>
<p>So I thought of documenting this for my own future reference and for the sake of the community.</p>
<p>Without wasting time, let me quickly explain how to serve static files with wicket (blatantly copied from <a href="http://wicketstuff.org/wicket14/staticpages/">wicket-examples</a>).</p>
<p><strong>Assumptions</strong></p>
<p>I assume that you are using wicket 1.4.x as that&#8217;s the latest stable version at the time of writing this post.</p>
<p><strong>Component</strong></p>
<p>First let us write a reusable component class called &#8220;StaticLink&#8221;.</p>
<pre class="brush: java; title: ; notranslate">
private class StaticLink extends WebMarkupContainer {
public StaticLink(String id, IModel model) {
super(id, model);
add(new AttributeModifier(&quot;href&quot;, true, model));
}
}
</pre>
<p><strong>Html</strong></p>
<p>In the html file where you want to put this link, add something like this:</p>
<pre class="brush: xml; title: ; notranslate">&lt;a&gt; My static link&lt;/a&gt;</pre>
<p><strong>Java</strong></p>
<p>In the respective java file, all you need to do is this:</p>
<pre class="brush: java; title: ; notranslate">
String contextPath = RequestUtils.toAbsolutePath(RequestCycle.get().
     getRequest().getRelativePathPrefixToWicketHandler());
add(new StaticLink(&quot;myStaticLink&quot;, new Model(contextPath + &quot;docs/index.html&quot;)));
</pre>
<p>Here were are resolving the absolute url of the static page which will free you from the <a href="http://stackoverflow.com/questions/2619833/wicket-relative-to-absolute-url-or-get-base-url">hassles of using a relative url</a> especially for static pages. The &#8220;contextPath&#8221; which we are constructing here will have the trailing &#8220;/&#8221; so you need not add it.</p>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/wicket-serving-static-files/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Extracting only date part of a date time column using JPA/Hibernate</title>
		<link>http://solitarygeek.com/java/extracting-only-date-part-of-a-date-time-column-using-jpa-hibernate</link>
		<comments>http://solitarygeek.com/java/extracting-only-date-part-of-a-date-time-column-using-jpa-hibernate#comments</comments>
		<pubDate>Mon, 11 Oct 2010 10:41:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[cast]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sqlserver]]></category>

		<guid isPermaLink="false">http://solitarygeek.com/java/extracting-only-date-part-of-a-date-time-column-using-hibernate</guid>
		<description><![CDATA[I recently had a need where I had to get only the date portion from a column whose data type is "timestamp" (which is mapped using @TimeStamp annotation). After hours of investigation, I found a way to do that using standard jpa/hql queries and hence thought of documenting it in this post. MySQL has a simple "date() function" that would just give the date part from a date time expression. Microsoft SQL Server offers a couple of ways to achieve the same. Unfortunately, I couldn't find any standard ways provided by jpa/hibernate to achieve this. Interestingly, the closest thing that can be considered as "standard" is the "cast function" which many databases seem to support. This prompted me to go for this solution because I felt this might be clean, as the syntax across different databases are pretty much similar. <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/extracting-only-date-part-of-a-date-time-column-using-jpa-hibernate">Extracting only date part of a date time column using JPA/Hibernate</a></span>]]></description>
			<content:encoded><![CDATA[<p>I recently came across a situation where I have to get only the date portion from a column whose data type is &#8220;timestamp&#8221; (which is mapped using @TimeStamp annotation). After hours of investigation, I found a way to do that using standard jpa/hql queries and hence thought of documenting it in this post.</p>
<p>MySQL has a simple &#8220;<a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date">date() function</a>&#8221; that would just give the date part from a date time expression. Microsoft SQL Server offers a <a href="http://stackoverflow.com/questions/566998/get-only-the-date-part-of-datetime-in-mssql">couple of ways</a> to achieve the same. Unfortunately, I couldn&#8217;t find any standard ways provided by jpa/hibernate to achieve this.</p>
<p>Interestingly, the closest thing that can be considered as &#8220;standard&#8221; is the &#8220;cast function&#8221; which <a href="http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html#function_cast">many</a> databases seem to <a href="http://msdn.microsoft.com/en-us/library/aa226054%28SQL.80%29.aspx">support</a>. This prompted me to go for this solution because I felt this might be clean, as the syntax across different databases are pretty much similar.</p>
<p>So I came up with a query something similar to this:</p>
<pre class="brush: sql; title: ; notranslate">

select cast(myDateTimeColumn as date) from MyTable
</pre>
<p>This worked flawlessly on MySQL! Great..!</p>
<p>But, I quickly ran into problem when hibernate executed the same jpl/hql query against Microsoft SQL Server. Hibernate acted a bit smart and generated the following query (trimmed for clarification):</p>
<pre class="brush: sql; title: ; notranslate">

select cast(myDateTimeColumn as dateTime) from MyTable
</pre>
<p>That&#8217;s not what I expected! That defeats the purpose of the &#8220;cast&#8221; function itself <img src='http://solitarygeek.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Why the heck Hibernate does this weird stuff? I thought of digging deep to learn more about this behaviour of Hibernate.</p>
<p>Hibernate uses the &#8220;<a href="http://www.javadocexamples.com/org/hibernate/dialect/function/org.hibernate.dialect.function.CastFunction-source.html">CastFunction</a>&#8221; class to handle &#8220;cast&#8221; functions you write in your queries. Upon exploring the class, you will find that this is how the &#8220;cast&#8221; functions are interpreted,</p>
<pre class="brush: java; title: ; notranslate">
 return &quot;cast(&quot; + args.get(0) + &quot; as &quot; + sqlType + ')';
 </pre>
<p>Where the &#8220;sqlType&#8221; is determined as follows:</p>
<pre class="brush: java; title: ; notranslate">
 String sqlType = factory.getDialect().getCastTypeName( sqlTypeCodes[0] );
 </pre>
<p>Hibernate <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.hibernate/hibernate/3.2.7.ga/org/hibernate/dialect/Dialect.java?av=f">stores</a> the type names in a <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.hibernate/hibernate/3.2.7.ga/org/hibernate/dialect/TypeNames.java?av=f">hash map</a> and by default, <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.hibernate/hibernate/3.2.7.ga/org/hibernate/dialect/AbstractTransactSQLDialect.java">registers</a> the &#8220;Date&#8221; type as &#8220;datetime&#8221; like this:</p>
<pre class="brush: java; title: ; notranslate">
 registerColumnType( Types.DATE, &quot;datetime&quot; );
 </pre>
<p>And that is exactly the reason for the weird behaviour I mentioned in the SQLServerDialect.</p>
<p>Fortunately, hibernate provides <a href="https://forum.hibernate.org/viewtopic.php?p=2436442">hooks</a> to <a href="http://community.jboss.org/wiki/Customsequences">tweak</a> the dialects to support the features that are not otherwise available by default. All we need to do this is to write a custom dialect class by subclassing the appropriate dialect. This is the custom sql server dialect class that I came with:</p>
<pre class="brush: java; title: ; notranslate">
 package org.hibernate.dialect;

import java.sql.Types;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

/**
 *
 * @author James Selvakumar
 */
 public class CustomSQLServerDialect extends SQLServerDialect
 {
 private static final Logger logger = LoggerFactory.getLogger(CustomSQLServerDialect.class);

@Override
 public String getCastTypeName(int code)
 {
 String castTypeName = &quot;&quot;;
 if (code == Types.DATE) {
 castTypeName = &quot;date&quot;;
 } else {
 castTypeName = super.getCastTypeName(code);
 }
 logger.debug(&quot;Code: {}, cast type name: {}&quot;, code, castTypeName);
 return castTypeName;
 }
 }
 </pre>
<p>That&#8217;s pretty simple, wasn&#8217;t it? We are playing safe here by overriding only the &#8220;<a href="http://grepcode.com/file/repo1.maven.org/maven2/org.hibernate/hibernate/3.2.7.ga/org/hibernate/dialect/Dialect.java?av=f">getCastTypeName</a>&#8221; method and returning the cast type name as &#8220;date&#8221; when the type is Types.DATE. We are delegating the responsibility to the super class for &#8220;getCastTypeName&#8221; requests other than Types.DATE.</p>
<p>Just update your hibernate configuration to make use of this dialect for sql server datasource.</p>
<p>Fortunately, this solution worked flawlessly for me on both MySQL 5.1 and Microsoft SQL Server 2008 databases. It didn&#8217;t work though with HSQLDB 1.8.</p>
<p>I hope this helps some of you. If you find any issues in this article or have any other great idea, consider sharing that in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/extracting-only-date-part-of-a-date-time-column-using-jpa-hibernate/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NetBeans and Maven &#8211; A quick start guide</title>
		<link>http://solitarygeek.com/java/netbeans-and-maven-a-quick-start-guide</link>
		<comments>http://solitarygeek.com/java/netbeans-and-maven-a-quick-start-guide#comments</comments>
		<pubDate>Sun, 26 Sep 2010 07:30:22 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[logback]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[pom]]></category>
		<category><![CDATA[quick start]]></category>
		<category><![CDATA[slf4j]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://solitarygeek.com/?p=551</guid>
		<description><![CDATA[<p>A few months ago, I was reading the book &#8220;Wicket in Action&#8221;. I was new to Wicket and Maven then. I followed the instructions given in the book to create a maven project. The book went one step further and explained how to create eclipse and idea projects from the pom, but nothing was mentioned about NetBeans. I felt sad that there is no maven plugin out there to create projects that NetBeans can understand.</p> <p>But later when I realized that there is no such need to create Netbeans projects from Maven pom, I was thrilled. Maven, is a first <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/netbeans-and-maven-a-quick-start-guide">NetBeans and Maven &#8211; A quick start guide</a></span>]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I was reading the book &#8220;Wicket in Action&#8221;. I was new to Wicket and Maven then. I followed the instructions given in the book to create a maven project. The book went one step further and explained how to create eclipse and idea projects from the pom, but nothing was mentioned about NetBeans. I felt sad that there is no maven plugin out there to create projects that NetBeans can understand.</p>
<p>But later when I realized that there is no such need to create Netbeans projects from Maven pom, I was thrilled. Maven, is a first class citizen in NetBeans. Any Maven project &#8220;<strong>is a</strong>&#8221; NetBeans project.</p>
<p>Over the months, as I continued to learn and use Maven, NetBeans made the the learning curve easy. So I thought of putting up this post to benefit new Maven users.</p>
<p><strong>Setup</strong></p>
<p>If you are using Maven for the first time, you may want to download and install it on your machine.</p>
<p>Though NetBeans comes with an embedded Maven instance (version 3.0-SNAPSHOT in NetBeans 6.9 at the time of writing this post), it&#8217;s still a good idea to have your own Maven instance, so that you can use it outside the IDE as well.</p>
<p>Installing Maven is quite easy. Download the latest Maven distribution (version 2.2.1 at the time of writing) and follow the installation instructions for your operating system.</p>
<p>Now, let&#8217;s quickly dive into action by firing up the IDE and create a new Maven project.</p>
<p><strong>Creating a new Maven project</strong></p>
<p>Open NetBeans IDE and click &#8220;File -&gt; New Project&#8221; and then choose &#8220;Maven&#8221; as the category and &#8220;Maven Project&#8221; as the project type.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-1.png" alt="NetBeans Maven Project - Step 1" width="747" height="506" /></p>
<p>In the next step, select &#8220;Maven Quickstart Archetype&#8221; as the maven archetype.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-2.png" alt="NetBeans Maven Project - Step 2" width="747" height="506" /></p>
<p>Finally, enter other details of your project and finish the wizard.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-3.png" alt="NetBeans Maven Project - Step 3" width="747" height="506" /></p>
<p>That should leave you with a new Maven project with a structure similar to this:</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-4.png" alt="NetBeans Maven Project - Step 4" width="286" height="261" /></p>
<p>One thing I like about NetBeans is that it always gives you some workable defaults whether it&#8217;s a web project or a simple java project.</p>
<p>No difference here. Just right click the java source file the IDE generated for you to watch your Maven project in action.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-5.png" alt="" width="668" height="313" /></p>
<p>And this is the default &#8220;pom.xml&#8221; the IDE generated for you:</p>
<pre class="brush: xml; title: ; notranslate">

&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;

&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;examples.maven&lt;/groupId&gt;
&lt;artifactId&gt;hellomaven&lt;/artifactId&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;name&gt;hellomaven&lt;/name&gt;
&lt;url&gt;http://maven.apache.org&lt;/url&gt;

&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;version&gt;3.8.1&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;

&lt;/project&gt;
</pre>
<p>If you know Maven already, you know what&#8217;s happening. Even if you are new to Maven, there is nothing to worry. Every Maven project needs a few mandatory definitions and that&#8217;s what you are seeing now.</p>

<p><strong>Improving the default project</strong></p>
<p>There are a couple of things we can improve in this project. First let us cleanup the &#8220;pom.xml&#8221;. As you can see, a depedency to junit 3.8.1 has been declared in the pom. That&#8217;s pretty archaic and let us change the junit version to the latest available version.</p>
<p>You need not scratch your head to figure out what&#8217;s the latest version of junit. The IDE is right there to help you. Keep the cursor near the version element and invoke the code completion by pressing the appropriate key. (In my case it&#8217;s CTRL + SPACE). Now, the IDE should give you a list of available junit versions in the default Maven remote repository.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-61.png" alt="" width="357" height="343" /></p>
<p>Choose the latest available junit version and save the details.</p>
<p>Let us rewrite the test case making use of the recent junit enhancements. Delete the existing unit test class and create a new one by right clicking the java source file and then selecting &#8220;Tools -&gt; Create Junit Tests&#8221;. You should see the IDE displaying a dialog saying that it cannot create junit 4.x tests.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-7.png" alt="" width="351" height="180" /></p>
<p>There is nothing wrong with the IDE here. Because JUnit 4.x makes use of annotations and hence need a Java source level of 1.5 or above. By default, Maven doesn&#8217;t assume your source files to be 1.5 compatible, so you need to tell Maven exactly what Java source version you would be using in your projects. Doing that is quite simple. Open the project&#8217;s &#8220;pom.xml&#8221; in the editor and define the Java source level like this.</p>
<pre class="brush: xml; title: ; notranslate">

&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;

&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;examples.maven&lt;/groupId&gt;
&lt;artifactId&gt;hellomaven&lt;/artifactId&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;name&gt;hellomaven&lt;/name&gt;
&lt;url&gt;http://maven.apache.org&lt;/url&gt;

&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;version&gt;4.8.1&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;

&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;source&gt;1.6&lt;/source&gt;
&lt;target&gt;1.6&lt;/target&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;

&lt;/project&gt;
</pre>
<p>You should be able to create JUnit 4.x tests from the IDE now.</p>
<p>Applying &#8220;Test Driven Development&#8221; to our project, let us create an unit test for an non-existent method in the java source.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-8.png" alt="" width="398" height="155" /></p>
<p>And now write the actual method in the java source so that the IDE doesn&#8217;t complain about the errors in our unit test.</p>
<pre class="brush: java; title: ; notranslate">

protected String sayHello(String input)
{
String output = &quot;Hello &quot; + input;
return output;
}
</pre>
<p>Go back to the unit test and run it.(I usually type CTRL + F6 to run the unit tests). Congrats! Your Maven project is seriously ready for prime time.</p>
<p>Do not take me wrong but it&#8217;s really a good practice to write unit tests for everything and that&#8217;s why I bothered you with this stuff.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-9.png" alt="" width="396" height="107" /></p>
<p><strong>Don&#8217;t use System.out.println!<br />
</strong></p>
<p>Though we are already familiar with dependencies, we only used JUnit which is a test dependency. And this is a good time to dive into the dependency hell by introducing our next dependency to this little project, &#8220;slf4j&#8221; or &#8220;Simple Logging Facade for Java&#8221;.</p>
<p>It&#8217;s hard to imagine any project without &#8220;logging&#8221; and our example project is no exception. (Heck, what&#8217;s there to log in this project???)</p>
<p>And with &#8220;slf4j&#8221; gaining wide spread adoption, let us make use of it. &#8220;slf4j&#8221; doesn&#8217;t tie our application to any logging framework (other than itself <img src='http://solitarygeek.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). It&#8217;s something like &#8220;jpa&#8221;. It gives you the freedom to choose your own logging provider. (My current favourite is logback)</p>
<p>Enough talking, let us starting using logging in our project.</p>
<p>To justify the use of logging, let us create some opportunity by updating our &#8220;main&#8221; method.</p>
<pre class="brush: java; title: ; notranslate">

public static void main(String[] args)
{
if(args != null &amp;&amp; args.length &gt; 0)
{
System.out.println(new App().sayHello(args[0]));
}else{
System.out.println(&quot;You have to pass atleast one argument to get a warm response from me!&quot;);
}
}
</pre>
<p>Time to fix those &#8220;System.out.println&#8221; calls by using slf4j. Create a slf4j Logger instance.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-10.png" alt="" width="652" height="23" /></p>
<p>That&#8217;s obvious. By no way the IDE can figure out what is happening here apart from resolving the &#8220;Logger&#8221; to java.util.logging which is not our objective.</p>
<p>Now click the edison&#8217;s bulb in the gutter to see what magic the IDE has under it&#8217;s hat.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-11.png" alt="" width="650" height="167" /></p>
<p>Select the option &#8220;Search Dependency at Maven Repositories&#8230;&#8221;. The IDE should popup a window with the possible matching artifacts.</p>
<p>Scroll to the bottom and locate &#8220;slf4j-api&#8221; and click &#8220;Add&#8221;. This will add the latest version of slf4j-api as a dependency. If you want to be more specific on the version, you can expand the slf4j-api node and choose the appropriate version.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-12.png" alt="" width="456" height="396" /></p>
<p>Go back to your &#8220;pom.xml&#8221; and see a new dependency for &#8220;slf4j-api&#8221; has been added. If you don&#8217;t want all this hassle, you can straight away add the following snippet in your pom.xml to add a dependency for slf4j-api.</p>
<pre class="brush: xml; title: ; notranslate">

&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
&lt;version&gt;1.6.1&lt;/version&gt;
&lt;type&gt;jar&lt;/type&gt;
&lt;/dependency&gt;
</pre>
<p>Fix your imports in the source file and you are set to use slf4j.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-13.png" alt="" width="636" height="207" /></p>
<p>Now change the reference to &#8220;System.out.println&#8221; with appropriate logging calls.</p>
<pre class="brush: java; title: ; notranslate">

public static void main(String[] args)
{
if(args != null &amp;&amp; args.length &gt; 0)
{
logger.info(new App().sayHello(args[0]));
}else{
logger.warn(&quot;You have to pass atleast one argument to get a warm response from me!&quot;);
}
}
</pre>
<p>Run your main class to ensure that everything is fine.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/Screenshot-14.png" alt="" /></p>
<p>That&#8217;s not we expected. Nothing is logged! There is nothing wrong with this phenomenon as we haven&#8217;t defined any logging provider yet. Remember, slf4j is just a specification.</p>
<p>Okay, it&#8217;s time to add a logging provider and with all the bias let us choose &#8220;logback&#8221; for this purpose. (Please feel free to use your preferred logging provider.)</p>
<p>Slf4j has a bunch of adapters for popular logging frameworks like &#8220;log4j&#8221; and &#8220;jul&#8221; (java.util.logging). (Please don&#8217;t raise flame wars by asking whether &#8220;jul&#8221; is really popular!)</p>
<p>If log4j is your cup of tea or coffee, please go ahead and check the slf4j manuals for further reference. <img src='http://solitarygeek.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I&#8217;ll use &#8220;logback&#8221; for this example and let us add the dependencies for that now. Right click the &#8220;Libraries&#8221; node of your project and click &#8220;Add Dependency&#8221;.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-15.png" alt="" width="454" height="318" /></p>
<p>The IDE should popup a window now where you can search the dependencies you want to add by typing the respective name in the &#8220;Query&#8221; field.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-16.png" alt="" width="516" height="553" /></p>
<p>To use logback in your project, you need to add the dependency &#8220;logback-classic&#8221;. (This will automatically add the transitive dependency &#8220;logback-core&#8221;)</p>
<p>Expand the respective node, choose the version you want and click &#8220;OK&#8221; to add them to the project.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-17.png" alt="" width="516" height="553" /></p>
<p>You can see the added dependencies in the &#8220;Libraries&#8221; node of the project.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-18.png" alt="" width="266" height="285" /></p>
<p>Again, if you are not a big fan of wizards, you can drop in the following snippet in the pom.xml straight away.</p>
<pre class="brush: xml; title: ; notranslate">

&lt;dependency&gt;
&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
&lt;version&gt;0.9.24&lt;/version&gt;
&lt;/dependency&gt;
</pre>
<p>That&#8217;s it. If you run the main class now, the logging calls should be negotiated properly.</p>
<p><img src="http://solitarygeek.com/blog/wp-content/uploads/2010/09/screenshot-20.png" alt="" /></p>
<p>To remove a dependency, you can either right click the respective dependency in the &#8220;Libraries&#8221; node and then click &#8220;Remove dependency&#8221; or edit your pom.xml and delete the respective reference to the dependency. It&#8217;s upto you.</p>
<p>To keep this post live up to it&#8217;s title, I&#8217;ll not discuss the tons of other Maven related stuffs NetBeans has. I&#8217;ll probably cover some of them in a later post.</p>
<p>For the sake of completeness, here is the final pom.xml:</p>
<pre class="brush: xml; title: ; notranslate">

&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;

&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;examples.maven&lt;/groupId&gt;
&lt;artifactId&gt;hellomaven&lt;/artifactId&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;name&gt;hellomaven&lt;/name&gt;
&lt;url&gt;http://maven.apache.org&lt;/url&gt;

&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;version&gt;4.8.1&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
&lt;version&gt;1.6.1&lt;/version&gt;
&lt;type&gt;jar&lt;/type&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
&lt;version&gt;0.9.24&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;

&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;source&gt;1.6&lt;/source&gt;
&lt;target&gt;1.6&lt;/target&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;

&lt;/project&gt;
</pre>
<p>And the java source file:</p>
<pre class="brush: java; title: ; notranslate">

package examples.maven.hellomaven;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Hello world!
*
*/
public class App
{
private static final Logger logger = LoggerFactory.getLogger(App.class);

public static void main(String[] args)
{
if(args != null &amp;&amp; args.length &gt; 0)
{
logger.info(new App().sayHello(args[0]));
}else{
logger.warn(&quot;You have to pass atleast one argument to get a warm response from me!&quot;);
}
}

protected String sayHello(String input)
{
String output = &quot;Hello &quot; + input;
return output;
}
}
</pre>
<p>The Junit test class:</p>
<pre class="brush: java; title: ; notranslate">
package examples.maven.hellomaven;

import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author james
 */
public class AppTest
{
 public AppTest()
 {
 }

 @Test
 public void testSayHello()
 {
 App app = new App();
 String input = &quot;Maven&quot;;
 String expected = &quot;Hello &quot; + input;
 String result = app.sayHello(input);
 assertEquals(expected, result);
 }
}
</pre>
<p>As you have seen above, NetBeans offers great support out-of-the-box for  Maven. No plugins required. If you are not a NetBeans user but use  Maven, I recommend you to give it a try. You&#8217;ll not be disappointed.</p>
<p>Thanks for reading patiently and please leave your comments if you have any.</p>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/netbeans-and-maven-a-quick-start-guide/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>What Java Look and Feel do you use?</title>
		<link>http://solitarygeek.com/java/what-java-look-and-feel-do-you-use</link>
		<comments>http://solitarygeek.com/java/what-java-look-and-feel-do-you-use#comments</comments>
		<pubDate>Mon, 09 Nov 2009 15:10:32 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Polls]]></category>
		<category><![CDATA[look and feel]]></category>
		<category><![CDATA[swing]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://www.solitarygeek.com/?p=519</guid>
		<description><![CDATA[<p>Quite some time back, I read an article titled &#8220;20+ Free Look and Feel Libraries For Java Swing&#8220;. I have evaluated most of the libraries mentioned in that article. Personally, I  prefer the System look and feel that is bundled in the JRE. However, I like Substance, PGS and JGoodies as well. Which one do you use? Curious to know.</p> Note: There is a poll embedded within this post, please visit the site to participate in this post's poll. ]]></description>
			<content:encoded><![CDATA[<p>Quite some time back, I read an article titled &#8220;<a href="http://javabyexample.wisdomplug.com/web-programming/37-core-java/65-20-free-look-and-feel-libraries-for-java-swings.html">20+ Free Look and Feel Libraries For Java Swing</a>&#8220;. I have evaluated most of the libraries mentioned in that article. Personally, I  prefer the System look and feel that is bundled in the JRE. However, I like Substance, PGS and JGoodies as well. Which one do you use? Curious to know.</p>
Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/what-java-look-and-feel-do-you-use/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Developing A Simple Java Application With Spring</title>
		<link>http://solitarygeek.com/java/developing-a-simple-java-application-with-spring</link>
		<comments>http://solitarygeek.com/java/developing-a-simple-java-application-with-spring#comments</comments>
		<pubDate>Tue, 03 Nov 2009 16:12:23 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.solitarygeek.com/java/java-spring/</guid>
		<description><![CDATA[<p>Introduction Spring is a powerful application framework that can be used across any layer in your application. For example, you can use Spring to manage only your data access layer or you can use Spring to provide remote services for your swing client. In this article, I will explain how to get started with Spring by developing a simple java application.</p> <p>Requirements 1. Your favorite IDE 2. Latest Spring framework.</p> <p>(Note: This article makes use of Spring framework 2.5.6 which is the current production release)</p> <p>The Application We are going to develop a simple application that fetches and display the <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/developing-a-simple-java-application-with-spring">Developing A Simple Java Application With Spring</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong><br />
Spring is a powerful application framework that can be used across any layer in your application. For example, you can use Spring to manage only your data access layer or you can use Spring to provide remote services for your swing client. In this article, I will explain how to get started with Spring by developing a simple java application.</p>
<p><strong>Requirements</strong><br />
1. Your favorite IDE<br />
2. <a href="http://www.springsource.org/download">Latest Spring framework</a>.</p>
<p>(Note: This article makes use of Spring framework 2.5.6 which is the current production release)</p>
<p><strong>The Application</strong><br />
We are going to develop a simple application that fetches and display the list of registered users. The application consists of just two interfaces, their implementation.</p>
<p><strong>The DAO layer</strong><br />
Let us now develop the DAO layer of the application. This layer consists of just one interface &#8220;UserDao&#8221; and it&#8217;s implementation &#8220;UserDaoImpl&#8221;. The interface consists of just one method named &#8220;getUsers()&#8221;. Let us quickly develop them.</p>
<p>Listing 1. UserDao</p>
<pre class="brush: java; title: ; notranslate">
package com.springapp.dao;
import java.util.Iterator;

/**
 *
 * @author James
 */
public interface UserDao
{
    Iterator&lt;String&gt; getUsers();
}
</pre>
<p>Listing 2. UserDaoImpl</p>
<pre class="brush: java; title: ; notranslate">

package com.springapp.dao;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author James
 */
public class UserDaoImpl implements UserDao
{
    public Iterator&lt;String&gt; getUsers()
    {
        List&lt;String&gt; users = new ArrayList&lt;String&gt;();
        users.add(&quot;Gavin King&quot;);
        users.add(&quot;Geertjan&quot;);
        users.add(&quot;Mike Keith&quot;);
        users.add(&quot;James&quot;);
        return users.iterator();
    }
}
</pre>
<p>Nothing fancy here. The implementation is pretty straight forward, though in a real environment you might fetch those details from the database using ORM frameworks like JPA.</p>
<p><strong>The Service Layer</strong></p>
<p>We will encapsulate the service layer from the dao implementaion by writing code against the interface UserDao. We will follow the same pattern we used in developing the dao layer and write the interface UserService and it&#8217;s implementation UserServiceImpl.</p>
<p>Listing 3. UserService</p>
<pre class="brush: java; title: ; notranslate">

package com.springapp.service;

import java.util.Iterator;

/**
 *
 * @author James
 */
public interface UserService
{
    Iterator&lt;String&gt; getUsers();
}
</pre>
<p>Listing 4. UserServiceImpl</p>
<pre class="brush: java; title: ; notranslate">

package com.springapp.service;

import com.springapp.dao.UserDao;
import java.util.Iterator;

/**
 *
 * @author James
 */
public class UserServiceImpl implements UserService
{
    private UserDao userDao;

    public Iterator&lt;String&gt; getUsers()
    {
        return userDao.getUsers();
    }

    public void setUserDao(UserDao userDao)
    {
        this.userDao = userDao;
    }
}
</pre>
<p>Kindly notice that both the service layer classes and dao layer classes are Spring agnostic. That&#8217;s the beauty of Spring. Spring is less invasive. Most of the application code can be developed without knowing anything about Spring.</p>

<p><strong>The Client</strong></p>
<p>Now we need someone to make use of our service layer and we will waste no time in developing the client for our service. We can just write a junit test class to invoke our service but I prefer to write a simple java class to be the client. Though our client will be a simple POJO class, you can easily replace it with a Swing or Web front end. Enough talking, let us dive into action! We will first develop our client as a normal java class without using Spring.</p>
<p><em>Standard Client</em></p>
<p>Listing 5. StandardUserServiceClient</p>
<pre class="brush: java; title: ; notranslate">

package com.springapp;

import com.springapp.dao.UserDao;
import com.springapp.dao.UserDaoImpl;
import com.springapp.service.UserServiceImpl;
import java.util.Iterator;

/**
 *
 * @author James
 */
public class StandardUserServiceClient
{

    private UserServiceImpl userService;

    public StandardUserServiceClient()
    {
        userService = new UserServiceImpl();
        UserDao userDao = new UserDaoImpl();
        userService.setUserDao(userDao);
    }

    private void fetchUsers()
    {
        Iterator&lt;String&gt; users = userService.getUsers();
        while (users.hasNext())
        {
            System.out.println(users.next());
        }
    }

    public static void main(String[] args)
    {
        StandardUserServiceClient client = new StandardUserServiceClient();
        client.fetchUsers();
    }
}
</pre>
<p>Hmm, there you can see our client code is &#8220;coupled&#8221; tightly with the service and dao implementations. That&#8217;s where Spring comes to our rescue. Spring will dynamically &#8220;inject&#8221; the implemenations so our application will remain &#8220;loosely&#8221; coupled.</p>
<p><em>Spring Client</em></p>
<p>But how will Spring know about our implementations? We need to inform Spring a little about our application and define the &#8220;hotspots&#8221; where it can dynamically &#8220;inject&#8221; the dependencies or implementations. Spring expects these details in a configuration file and let us quickly write that. Create a package called &#8220;resources&#8221; and create a xml file called &#8220;applicationContext.xm&#8221; inside it.</p>
<p>Listing 6. applicationContext.xml</p>
<pre class="brush: xml; title: ; notranslate">

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
 xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
 xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd&quot;&gt;

 &lt;bean id=&quot;userDao&quot; class=&quot;com.springapp.dao.UserDaoImpl&quot;&gt;
 &lt;/bean&gt;

 &lt;bean id=&quot;userService&quot; class=&quot;com.springapp.service.UserServiceImpl&quot;&gt;
     &lt;property name=&quot;userDao&quot; ref=&quot;userDao&quot;/&gt;
 &lt;/bean&gt;
&lt;/beans&gt;
</pre>
<p>In the &#8220;applicationContext.xml&#8221; file we defiend two beans named &#8220;userDao&#8221; and &#8220;userService&#8221;. We also specified their implementations using the &#8220;class&#8221; attribute. Also notice that we are setting the property &#8220;userDao&#8221;  in the &#8220;UserServiceImpl&#8221; class with &#8220;UserDaoImpl&#8221; by referencing it&#8217;s name &#8220;userDao&#8221;. Pretty straighforward!</p>
<p>Now it&#8217;s time to churn out our Spring client.</p>
<p>Listing 7. SpringUserServiceClient</p>
<pre class="brush: java; title: ; notranslate">

package com.springapp;

import com.springapp.service.UserService;
import java.util.Iterator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author James
 */
public class SpringUserServiceClient
{
    private UserService userService;

    public SpringUserServiceClient()
    {
        //initialize the spring container
        ApplicationContext context = new ClassPathXmlApplicationContext(&quot;resources/applicationContext.xml&quot;);
        userService = (UserService) context.getBean(&quot;userService&quot;);
    }

    private void fetchUsers()
    {
        Iterator&lt;String&gt; users = userService.getUsers();
        while(users.hasNext())
        {
            System.out.println(users.next());
        }
    }

    public static void main(String[] args)
    {
        SpringUserServiceClient client = new SpringUserServiceClient();
        client.fetchUsers();
    }
}
</pre>
<p>A couple of details about this class:</p>
<ul>
<li>The ApplicationContext interface helps us to plug into the Spring container and lookup the classes we need by using the name we defined in the xml file.</li>
<li>There are many implementataions of ApplicationContext available in Spring. One of the most widely used implementation is &#8220;ClassPathXmlApplicationContext&#8221;. It is used to load Spring configuration files found in classpath.</li>
</ul>
<p>As seen from Listing 7, Spring helps us to program to interfaces and develop loosely coupled applications. As a result, applications become more testable as there are no external dependencies like application server. It is also very easy to switch the implementations effortlessly. For example, in our sample application you can easily write a UserDaoMockImpl and use it in your test cases effortlessly.</p>
<p><strong>Project Structure</strong></p>
<p>Here is the complete application looks like:</p>
<p><strong><img class="alignnone size-full wp-image-515" title="screenshot1" src="http://solitarygeek.com/blog/wp-content/uploads/2009/11/screenshot1.png" alt="screenshot1" width="302" height="310" /><br />
</strong></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=d7d85c06-7c20-8a72-ae33-ec6bc5f32317" alt="" /></div>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/developing-a-simple-java-application-with-spring/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Developing A Simple Pluggable Java Application</title>
		<link>http://solitarygeek.com/java/a-simple-pluggable-java-application</link>
		<comments>http://solitarygeek.com/java/a-simple-pluggable-java-application#comments</comments>
		<pubDate>Sun, 20 Sep 2009 15:23:12 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[pluggable]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.solitarygeek.com/java/a-simple-pluggable-java-application/</guid>
		<description><![CDATA[<p>Most of the applications we use on daily basis are pluggable. Popular applications like Firefox, Eclipse, NetBeans, JEdit, WordPress, Hudson are all pluggable. In fact, pluggability has played a major part in the success of most of these applications. Why not make the Java applications we develop pluggable as well? Yes, we get pluggability out of the box, if our applications are based on a rich client platform like NetBeans or Eclipse. But for some reasons if you decide not to use those platforms, it doesn&#8217;t mean that they should not be pluggable. In this article, we will learn how <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/a-simple-pluggable-java-application">Developing A Simple Pluggable Java Application</a></span>]]></description>
			<content:encoded><![CDATA[<p>Most of the applications we use on daily basis are pluggable. Popular applications like Firefox, Eclipse, NetBeans, JEdit, WordPress, Hudson are all pluggable. In fact, pluggability has played a major part in the success of most of these applications. Why not make the Java applications we develop pluggable as well? Yes, we get pluggability out of the box, if our applications are based on a rich client platform like NetBeans or Eclipse. But for some reasons if you decide not to use those platforms, it doesn&#8217;t mean that they should not be pluggable. In this article, we will learn how to write a simple pluggable application that will load it&#8217;s plugins dynamically.</p>
<p><strong>The API<br />
</strong>First, let us define a plugin interface that should be implemented by all the plugins of our application. We are going to keep it very simple. Create a project called &#8220;plugin-api&#8221; in your favorite IDE and create the interface &#8220;ApplicationPlugin&#8221;.</p>
<p><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/09/screenshot1-p2.png" alt="" /></p>
<pre class="brush: java; title: ; notranslate">

package com.pluggableapp.plugins.api;

public interface ApplicationPlugin
{
    String getName();
    void init();
}
</pre>
<p><span id="more-464"></span></p>
<p><strong>The Plugins</strong></p>
<p>Writing the plugins now is very easy. Our plugins need to implement the plugin interface and follow a simple convention to make it easy for our applications to find them later. Create a project called &#8220;plugin-a&#8221; and develop our first plugin.</p>
<pre class="brush: java; title: ; notranslate">

package com.pluggableapp.plugins;

import com.pluggableapp.plugins.api.ApplicationPlugin;
import java.util.logging.Logger;

public class PluginA implements ApplicationPlugin
{
    private static Logger logger = Logger.getLogger(PluginA.class.getName());

    public String getName()
    {
        return &quot;Plugin A&quot;;
    }

    public void init()
    {
        logger.info(getName() + &quot; initialized!&quot;);
    }
}
</pre>
<p>Now create a directory called &#8220;META-INF/services&#8221; inside the source directory and create a file with the name &#8220;com.pluggableapp.plugins.api.ApplicationPlugin&#8221; (This is the fully qualified name of the plugin interface). The file should contain the name of the actual plugin inside it. In our case, the text is &#8220;com.pluggableapp.plugins.PluginA&#8221;.</p>
<p><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/09/screenshot4-p.png" alt="" /></p>
<p>Repeat these steps to create PluginB.</p>

<p><strong>The Application</strong></p>
<p>It&#8217;s time to create the application that will consume the plugins we created. First let us create a class to add the plugin jars to the classpath dynamically.</p>
<pre class="brush: java; title: ; notranslate">

package com.pluggableapp;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.logging.Logger;

public class ClasspathUtils
{

 private static Logger logger = Logger.getLogger(ClasspathUtils.class.getName());
 // Parameters
 private static final Class[] parameters = new Class[]
 {
     URL.class
 };

 /**
 * Adds the jars in the given directory to classpath
 * @param directory
 * @throws IOException
 */
 public static void addDirToClasspath(File directory) throws IOException
 {
     if (directory.exists())
     {
         File[] files = directory.listFiles();
         for (int i = 0; i &lt; files.length; i++)
         {
             File file = files[i];
             addURL(file.toURI().toURL());
         }
     }
     else
     {
         logger.warning(&quot;The directory \&quot;&quot; + directory + &quot;\&quot; does not exist!&quot;);
     }
}

 /**
 * Add URL to CLASSPATH
 * @param u URL
 * @throws IOException IOException
 */
 public static void addURL(URL u) throws IOException
 {
     URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
     URL urls[] = sysLoader.getURLs();
     for (int i = 0; i &lt; urls.length; i++)
     {
         if (urls[i].toString().equalsIgnoreCase(u.toString()))
         {
             logger.info(&quot;URL &quot; + u + &quot; is already in the CLASSPATH&quot;);
             return;
         }
     }
     Class sysclass = URLClassLoader.class;
     try
     {
         Method method = sysclass.getDeclaredMethod(&quot;addURL&quot;, parameters);
         method.setAccessible(true);
         method.invoke(sysLoader, new Object[]
         {
             u
         });
     } catch (Throwable t)
     {
         t.printStackTrace();
         throw new IOException(&quot;Error, could not add URL to system classloader&quot;);
     }
  }
}
</pre>
<p>Now create an interface called &#8220;PluginService&#8221; to define the methods needed to load and initialize the plugins.</p>
<pre class="brush: java; title: ; notranslate">

package com.pluggableapp;

import com.pluggableapp.plugins.api.ApplicationPlugin;
import java.util.Iterator;

public interface PluginService
{
    Iterator&lt;ApplicationPlugin&gt; getPlugins();
    void initPlugins();
}
</pre>
<p>As of version 1.6, the Java runtime ships with a class called &#8220;ServiceLoader&#8221; to easily find and load plugins. Let us now write a implementation called &#8220;StandardPluginService&#8221; and make use of the facilities built into the java runtime.</p>
<pre class="brush: java; title: ; notranslate">

package com.pluggableapp;

import com.pluggableapp.PluginService;
import com.pluggableapp.plugins.api.ApplicationPlugin;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.logging.Logger;

public class StandardPluginService implements PluginService
{
    private static StandardPluginService pluginService;
    private ServiceLoader&lt;ApplicationPlugin&gt; serviceLoader;
    private Logger logger = Logger.getLogger(getClass().getName());

    private StandardPluginService()
    {
        //load all the classes in the classpath that have implemented the interface
        serviceLoader = ServiceLoader.load(ApplicationPlugin.class);
    }

    public static StandardPluginService getInstance()
    {
        if(pluginService == null)
        {
            pluginService = new StandardPluginService();
        }
        return pluginService;
    }

    public Iterator&lt;ApplicationPlugin&gt; getPlugins()
    {
        return serviceLoader.iterator();
    }

    public void initPlugins()
    {
        Iterator&lt;ApplicationPlugin&gt; iterator = getPlugins();
        if(!iterator.hasNext())
        {
            logger.info(&quot;No plugins were found!&quot;);
        }
        while(iterator.hasNext())
        {
            ApplicationPlugin plugin = iterator.next();
            logger.info(&quot;Initializing the plugin &quot; + plugin.getName());
            plugin.init();
        }
    }
}
</pre>
<p>Feel free to write your own implementation if needed. For example you can easily write an implementation based on the NetBeans API.</p>
<p>Write a factory class named &#8220;PluginServiceFactory&#8221; to create &#8220;PluginService&#8221; objects.</p>
<pre class="brush: java; title: ; notranslate">

package com.pluggableapp;

import com.pluggableapp.*;
import com.pluggableapp.StandardPluginService;
import com.pluggableapp.PluginService;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class PluginServiceFactory
{
    public static PluginService createPluginService()
    {
        addPluginJarsToClasspath();
        return StandardPluginService.getInstance();
    }

    private static void addPluginJarsToClasspath()
    {
        try
        {
            //add the plugin directory to classpath
            ClasspathUtils.addDirToClasspath(new File(&quot;plugins&quot;));
        } catch (IOException ex)
        {
            Logger.getLogger(PluginServiceFactory.class.getName()).log(
                Level.SEVERE, null, ex);
        }
    }
}
</pre>
<p>That&#8217;s it. All we need to do now is to write a class that will invoke the &#8220;PluginServiceFactory&#8221;.</p>
<pre class="brush: java; title: ; notranslate">

package com.pluggableapp;

import com.pluggableapp.plugins.api.ApplicationPlugin;
import java.util.Iterator;
import java.util.logging.Logger;

public class Main
{

    private static Logger logger = Logger.getLogger(Main.class.getName());

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args)
    {
        loadPlugins();
    }

    private static void loadPlugins()
    {
        PluginService pluginService = PluginServiceFactory.createPluginService();
        pluginService.initPlugins();
    }
}
</pre>
<p>Before we build and see the application in action, create a directory called &#8220;plugins&#8221; and put all plugin jars there.</p>
<p><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/09/screenshot3-p1.png" alt="" /></p>
<p>And this is what you might see when you run our pluggable application.</p>
<p><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/09/screenshot2-p1.png" alt="" /></p>
<p>Now feel free to create as many plugins you want to write and just drop them in the &#8220;plugins&#8221; directory and restart the &#8220;pluggable&#8221; application to see your &#8220;home grown&#8221; plugins in action!</p>
<p><strong>Resources</strong></p>
<p><a href="http://java.sun.com/developer/technicalArticles/javase/extensible/index.html">Creating Extensible Applications With the Java Platform</a> &#8211; <em>John O&#8217;Conner</em></p>
<p><a href="http://twit88.com/blog/2007/10/07/develop-a-java-plugin-framework/">Developing a Java Plugin Framework </a></p>
<p><a href="http://java.dzone.com/news/how-create-pluggable-photo-alb">How to Create a Pluggable Photo Album in Java</a> &#8211; <em>Geertjan</em></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=d7d85c06-7c20-8a72-ae33-ec6bc5f32317" alt="" /></div>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/a-simple-pluggable-java-application/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Five different uses of Java Applets</title>
		<link>http://solitarygeek.com/java/five-different-uses-of-java-applets</link>
		<comments>http://solitarygeek.com/java/five-different-uses-of-java-applets#comments</comments>
		<pubDate>Sat, 22 Aug 2009 09:54:42 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[applets]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.solitarygeek.com/java/java-technology-tech-computers-software-applications-tools-applets/</guid>
		<description><![CDATA[<p>In a world where everyone is using technologies like Flash, Silverlight etc to present rich content, are Java Applets still used? Are they still relevant? The answer is &#8211; &#8220;Yes&#8221;. Apart from being used primarily for playing online games, Java Applets are still used in many different ways. Here I would like to highlight a few applications that put Applets to good use.</p> <p>1. Online Office Suite ThinkFree is a very popular and professional online office suite based on Java Applet and Ajax.</p> <p></p> <p>2. Virtualization JPC or Java PC Emulator is a pure java based virtualization software that can <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/five-different-uses-of-java-applets">Five different uses of Java Applets</a></span>]]></description>
			<content:encoded><![CDATA[<p>In a world where everyone is using technologies like Flash, Silverlight etc to present rich content, are Java Applets still used? Are they still relevant? The answer is &#8211; &#8220;Yes&#8221;. Apart from being used primarily for playing online games, Java Applets are still used in many different ways. Here I would like to highlight a few applications that put Applets to good use.</p>
<p><strong>1. Online Office Suite</strong><br />
<a href="http://thinkfree.com">ThinkFree</a> is a very popular and professional online office suite <a href="http://en.wikipedia.org/wiki/ThinkFree_Office">based on Java Applet and Ajax</a>.</p>
<p><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/08/screenshot2-p1.png" alt="" /></p>
<p><strong>2. Virtualization</strong><br />
<a href="http://www-jpc.physics.ox.ac.uk/home_home.html">JPC</a> or <a href="http://www-jpc.physics.ox.ac.uk/home_home.html">Java PC Emulator</a> is a pure java based virtualization software that can be used to boot your virtual computers right inside the browser. Yes they run as &#8220;Java Applets&#8221; inside the browser.</p>
<p><strong>3. Remote Desktop Viewer</strong><br />
Products like <a href="http://www.tightvnc.com/">TightVNC</a> and <a href="http://www.uvnc.com/">UltraVNC</a> provide a java applet based client to view remote desktops.</p>
<p><strong>4. (Web) Operating System<br />
</strong><a href="http://icloud.com">iCloud</a>, is an web operating sytem that makes use of XML and Java Applet Technology (atleast for Firefox).</p>
<p><strong>5. File Upload</strong></p>
<p><a href="http://www.facebook.com">Facebook</a> uses a beautifully designed Java Applet to upload photos to facebook photo albums.<br />
<a href="http://net2ftp.com">net2ftp</a> is a web based ftp client that makes use of tiny Java Applet to &#8220;drag and drop&#8221; files from local computer to the browser and upload them to the remote ftp server.</p>
<p><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/08/screenshot1-p.png" alt="" /></p>
<p>If you have come across any website that make use of Java Applets, please share your thoughts in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/five-different-uses-of-java-applets/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hudson CI Server &#8211; A quick start guide</title>
		<link>http://solitarygeek.com/java/hudson-ci-server-a-step-by-step-guide-part-i</link>
		<comments>http://solitarygeek.com/java/hudson-ci-server-a-step-by-step-guide-part-i#comments</comments>
		<pubDate>Fri, 24 Jul 2009 14:53:26 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[continuous-integration]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.solitarygeek.com/?p=120</guid>
		<description><![CDATA[<p>Introduction</p> <p> Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily &#8211; leading to multiple integrations per day. - Martin Fowler</p> <p> Hudson is a popular open-source continuous integration server used by many organizations like Redhat JBoss. Though there are many well known and well established open-source projects like CruiseControl, Continnum and some commercial offerings like Bamboo, what makes Hudson special is it&#8217;s powerful yet easy to use web interface, it&#8217;s simplicity and it&#8217;s extensible architecture with many plugins.</p> <p> Objective</p> <p> The objective of this <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/hudson-ci-server-a-step-by-step-guide-part-i">Hudson CI Server &#8211; A quick start guide</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p><strong> </strong> Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily &#8211; leading to multiple integrations per day.<br />
- <a href="http://martinfowler.com/articles/continuousIntegration.html">Martin Fowler</a></p>
<p><span> </span><span><a href="https://hudson.dev.java.net/">Hudson</a></span><span> is a popular open-source continuous integration server used by many organizations like Redhat <a href="http://hudson.jboss.org/hudson/">JBoss</a>. Though there are many well known and well established open-source projects like <a href="http://cruisecontrol.sourceforge.net/">CruiseControl</a>, <a href="http://continuum.apache.org/">Continnum</a></span><span> and some commercial offerings like <a href="http://www.atlassian.com/software/bamboo/">Bamboo</a>, what makes </span><span>Hudson special is it&#8217;s powerful yet easy to use web interface, it&#8217;s simplicity and it&#8217;s extensible architecture with many plugins.</span></p>
<p><span><span id="more-120"></span></span><span><br />
</span><span><strong>Objective</strong></span></p>
<p><span><strong> </strong>The objective of this tutorial is to setup, configure and learn to use <a href="https://hudson.dev.java.net/">Hudson</a> by building &#8220;<a href="http://commons.apache.org/io/">Apache Commons IO</a>&#8220;, a well known java project.<br />
<strong><br />
</strong></span><span><strong>Requirements<br />
</strong></span></p>
<ul>
<li><span><a href="https://hudson.dev.java.net/">Hudson</a></span></li>
<li><span>Subversion (or any other version control system like CVS, Mercurial, Git if you want to build your own project)<br />
</span></li>
<li><span>(Optional) <a href="http://tomcat.apache.org/">Tomcat</a> or <a href="https://glassfish.dev.java.net/">Glassfish</a></span></li>
<li><span>Apache Ant (or Maven)<br />
</span></li>
</ul>
<p><span><strong>Installation and Starting Hudson</strong></span></p>
<p><span>Installing Hudson is super easy. Just download the <a href="http://hudson-ci.org/latest/hudson.war">war</a> file, open your terminal/command-prompt and issue the command &#8220;java -jar hudson.war&#8221;. Now point your browser to <a href="http://localhost:8080">http://localhost:8080</a>. That was easy, right?</span></p>
<p><span>Hudson has an embedded servlet container called &#8220;<a href="http://winstone.sourceforge.net/">Winstone</a>&#8221; which works much like a standard servlet container like Tomcat by serving your JSP pages and servlets.</span></p>
<p><span>If you want Hudson to start on a different port, say 8180, issue the following command,<br />
&lt;code&gt; java -jar hudson.war &#8211;httpPort=8180 &lt;/code&gt;</span></p>
<p><span>Ofcourse you can deploy Hudson to Tomcat, Glassfish or any other supported servlet containers. The following guides can be useful in that case:<br />
</span></p>
<ul>
<li><span><a href="http://wiki.hudson-ci.org/display/HUDSON/Tomcat">Hudson and Tomcat</a></span></li>
<li><span><a href="https://hudson.dev.java.net/containers/glassfish.html">Hudson and Glassfish</a></span></li>
</ul>
<p><span>More container specific guides can be found from this <a href="http://wiki.hudson-ci.org/display/HUDSON/Containers">hudson wiki</a>.</span></p>
<p><span>Once you started Hudson or deployed it to a servlet container, this is what you might see in your browser when you start Hudson for the first time.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson1-p.png" alt="" /></span></p>
<p><span><strong>Hudson Home Directory</strong></span></p>
<p><span>All your Hudson jobs/settings are stored in the Hudson home directory. If you did not specify one, Hudson shall assume some defaults like &lt;code&gt; ~/.hudson &lt;/code&gt; in Linux or your respective home directory in Windows. It&#8217;s ok to go ahead with the defaults while you test drive Hudson but once you are done, I strongly recommend you to define a Hudson home directory of your choice, preferrably on a separate partition or drive. This will ensure that all your Hudson configuration/jobs are intact in case of any system crash.</span></p>
<p><span>Say, suppose your home directory is &#8220;/hudson&#8221; (in Linux), this is how you will define the Hudson home directory,</span></p>
<p><span>If you are using the embedded servlet container,<em> </em>start it by specifying the java system property &#8220;HUDSON_HOME&#8221;,<br />
&lt;code&gt; java -DHUDSON_HOME=/hudson -jar hudson.war &lt;/code&gt;</span></p>
<p><span>If you are using Tomcat, follow the explanations in <a href="http://wiki.hudson-ci.org/display/HUDSON/Tomcat">this wiki</a>. However, if you run Tomcat as a windows service, you need to do some tweaking to let Tomcat set this property. In that case, you will be better off if you start Tomcat using it&#8217;s batch file and set the property right there. (Or if you managed to run Tomcat as a Windows Service and still able to define the Hudson home correctly, why don&#8217;t you share your views with us?)</span></p>
<p><span>If you are using Glassfish, go to admin console and add the JVM option &lt;code&gt; -DHUDSON_HOME=/hudson&lt;/code&gt;. More detailed explanations can be found on <a href="http://wiki.hudson-ci.org/display/HUDSON/Glassfish">this wiki</a>.</span></p>
<p><span>Just remember that the idea is to define a system property &#8220;HUDSON_HOME&#8221; through any of the possible ways.</span></p>
<p><span>This is how the Hudson home directory shall look like.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson2-p.png" alt="" /></span></p>
<p><span><strong>Manage Hudson</strong></span></p>
<p><span><strong> </strong>Hudson provides an easy to use web interface to manage the configurations needed to administer a continuous integration server. Let us do some basic configurations to get Hudson ready.</span></p>
<p><span>Start Hudson and click the &#8220;Manage Hudson&#8221; link located on the left. </span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson3-p.png" alt="" /></span></p>
<p><span>Now click &#8220;Configure System&#8221;. Hudson will display a page where you can configure things like access control, JDK, Ant, Email Settings etc.<br />
</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson4-p.png" alt="" /></span></p>
<p><span><em><strong>Access Control</strong></em></span></p>
<p><span><em> </em>We will enable security to secure our Hudson setup. Otherwise anybody can go and meddle with your Hudson jobs. If you don&#8217;t want that to happen, check the &#8220;Enable Security&#8221; checkbox.</span></p>
<p><span><img class="alignnone size-full wp-image-128" title="hudson4a-3-p" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson4a-3-p.png" alt="hudson4a-3-p" width="498" height="76" /></span></p>
<p><span><br />
</span></p>
<p><span> </span></p>
<p><span>Once security is enabled, we need to tell Hudson the type of &#8220;Access Control&#8221; we want to use. Let us choose the Security Realm as &#8220;Hudson&#8217;s own user database&#8221; and leave the option &#8220;Enable users to signup&#8221; as checked. (If you do not check the &#8220;sign up&#8221; option here, Hudson is definitely going to whack you later!. ) Under the &#8220;Authorization&#8221; section, choose &#8220;Matrix-based Security&#8221;.</span></p>
<p><span><img class="alignnone size-full wp-image-129" title="hudson4a-4-p" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson4a-4-p.png" alt="hudson4a-4-p" width="382" height="330" /><br />
</span></p>
<p><span> </span></p>
<p><span>Now add an user called &#8220;administrator&#8221; and give the necessary privileges. ENSURE THAT YOU GIVE &#8220;ADMINISTER&#8221; PRIVILEGES TO THIS USER or else, you may not able to access the administrative console once security and access control are enabled. (Again, if you miss it, Hudson is gonna whack you!)</span></p>
<p><span><img class="alignnone size-full wp-image-130" title="hudson6-1-p" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson6-1-p.png" alt="hudson6-1-p" width="579" height="118" /><br />
</span></p>
<p><span> </span></p>
<p><span>Hudson will display an error symbol near the user we just added. That&#8217;s because the user does not exist  in the system. Do not bother, we will create the user a little later. Now go ahead and add users who might be accessing Hudson. Give appropriate access controls to the users and do not give full access to everyone. That will eventually create a system that is difficult to manage. </span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson7-p.png" alt="" /></span></p>
<p><span><strong><em>Configure JDK</em></strong></span></p>
<p><span>Done with security? Now we need to configure the JDK which Hudson shall use to build the jobs. Find out the section &#8220;JDK&#8221; in the same page. Click the &#8220;Add JDK&#8221; button and then enter the details of your JDK.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson9-p.png" alt="" /></span></p>
<p><span><em><strong>Configure Ant</strong></em></span></p>
<p><span><em> </em>We need to tell Hudson where Ant is located. Find out the section called &#8220;Ant&#8221;, click &#8220;Add Ant&#8221; and enter the respective details.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson10-p.png" alt="" /></span></p>
<p><span>(Follow the same procedure, if you want to configure Maven.)</span></p>
<p><span>That&#8217;s it! Hudson is now almost ready for prime time. Feel free to configure the Email Settings as well with the appropriate values. When you are done, press the &#8220;Save&#8221; button to save all the changes you have made.</span></p>
<p><span>Once you press the &#8220;Save&#8221; button, Hudson will redirect you to a login page.</span></p>
<p><span><em><strong>Manage Users</strong></em></span></p>
<p><span><em> </em>Click the &#8220;Signup&#8221; link at the top right corner of Hudson and register a new user called &#8220;administrator&#8221; (or whatever name you gave in the &#8220;Access Control&#8221; section).</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson13-p.png" alt="" /></span></p>
<p><span>Hudson will automatically login the user provided the user was already configured in the &#8220;Access Control&#8221; section. Once a new user (administrator) is registered in the system, Hudson will provide an option called &#8220;Manage Users&#8221; in the &#8220;Manage Hudson&#8221; page.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson15-p.png" alt="" /></span></p>
<p><span>You can now create other users from this page.</span></p>
<p><span><img class="alignnone size-full wp-image-125" title="hudson16-1-p" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson16-1-p.png" alt="hudson16-1-p" width="345" height="183" /><br />
</span></p>
<p><span>You will be using this page to manage all your Hudson users. Looks like we have covered quite a lot of information. It&#8217;s time now to create some jobs and see Hudson in action.</span></p>
<p><span><strong>Creating Job</strong></span></p>
<p><span><strong> </strong>That&#8217;s the core feature of Hudson. Hudson jobs can fetch the source code from a repository, execute your build scripts, run your tests, prepare javadoc, notify you in case of any failure, archive the build artifacts and much more. That&#8217;s where you can really see the power of Hudson. Enough talking, let us explore these Hudson features now by creating a job.</span></p>
<p><span>The Hudson job which we are going to create now is going to be very simple and is capable of doing the following:<br />
</span></p>
<ul>
<li><span>Checkout the source code of <a href="http://commons.apache.org/io/">apache commons-io</a> project using subversion<br />
</span></li>
<li><span>Run the build script (build.xml in case of Ant, pom.xml for Maven)</span></li>
<li><span>Archive the build output<br />
</span></li>
</ul>
<p><span>Create a job by clicking the link &#8220;New Job&#8221; on the left. Give a name for the job, select the option &#8220;Build a free-style software project&#8221; and then press &#8220;OK&#8221;.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson18-p.png" alt="" /></span></p>
<p><span><strong>Configure Job</strong><br />
</span></p>
<p><span> Hudson will create a new empty job for us which we need to configure.</span></p>
<p><span><img class="alignnone size-full wp-image-127" title="hudson19-1-p" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson19-1-p.png" alt="hudson19-1-p" width="496" height="253" /><br />
</span></p>
<p><span> </span></p>
<p><span>Let us configure the repository for this job first. Go to the section &#8220;Source Code Management&#8221;, choose the option &#8220;Subversion&#8221; and enter the repository url  as &#8220;<a href="http://svn.apache.org/repos/asf/commons/proper/io/trunk">http://svn.apache.org/repos/asf/commons/proper/io/trunk</a>&#8220;. Enter the &#8220;Local module directory&#8221; as  &#8220;.&#8221;</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson20-p.png" alt="" /></span></p>
<p><span>Look for the section called &#8220;Build&#8221;. Click the button &#8220;Add build step&#8221; and select &#8220;Invoke Ant&#8221;. Leave the rest to default. (Maven users, choose the appropriate action)</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson22-p1.png" alt="" /></span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson23-p.png" alt="" /><br />
Go to the section &#8220;Post-build Actions&#8221;. Select the checkbox &#8220;Archive the artifacts&#8221;. The apache commons-io build script shall create the jar in the directory named &#8220;target&#8221;. So enter the value &#8220;target/*.jar&#8221; in the text field titled &#8220;Files to archive&#8221;. Though this is not mandatory to build a job, I recommend you to do this as this will help the users of your continuous integration server to download the build outputs quickly.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson24-p.png" alt="" /></span></p>
<p><em><span> NOTE: Since we are building the apache-commons-io project we are entering the value &#8220;target/*.jar&#8221;. If for example, your build output directory is &#8220;dist&#8221;, then you should enter here as &#8220;dist/*.jar&#8221;.</span><br />
</em><span><br />
Press the &#8220;Save&#8221; button at the bottom. Our job is ready and just click link &#8220;Build Now&#8221; at the left to start building the job.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson25-p.png" alt="" /></span></p>
<p><span>Once the build is initiated, you can relax and watch the progress in the &#8220;Build History&#8221;.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson26-p.png" alt="" /></span></p>
<p><span>If you are restless and want to see exactly what is going on, just click the link (corresponding to the build number) in the &#8220;Build History&#8221;.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson27-p.png" alt="" /></span></p>
<p><span>Now click the link &#8220;Console Output&#8221;.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson28-p.png" alt="" /></span></p>
<p><span>Hudson will display you the console view where you can do all your research.</span></p>
<p><span><br />
</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson29-p.png" alt="" /></span></p>
<p><span>Now that the build is successful, you might want to have a look at the jar built by this job. You can find that under &#8220;Last Successful Artifacts&#8221;. </span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson30-p.png" alt="" /></span></p>
<p><span>You can also have a sneak preview about the builds from your Hudson home page.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson31-p.png" alt="" /></span></p>
<p><span>If in case some of your builds failed, Hudson will report that as well neatly along with displaying the build stability. </span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/hudson32-p.png" alt="" /></span></p>
<p><span>That&#8217;s it for now. But you can do a lot more like configuring Hudson to build this job every few minutes or just poll the repository once in a while and trigger the build whenever someone commits to the repository. Explore them under the job&#8217;s configuration page and enjoy. And did I mention that Hudson has a lot of good plugins already? Maybe I will try to cover those advanced concepts in my next post.</span></p>
<p><span>If you are using NetBeans as your IDE, then you have a got a lot of Hudson features integrated right into the NetBeans IDE. Check that out in my post <a href="http://www.solitarygeek.com/java/netbeans-6-7-a-quick-glance/">NetBeans 6.7 &#8211; A quick glance</a>.</span></p>
<p><span>Are you using Hudson? Are you planning to use Hudson? Why not leave a comment below and share your thoughts?</span></p>
<p><span>Read also: &#8220;<a href="http://solitarygeek.com/java/netbeans-and-maven-a-quick-start-guide">NetBeans and Maven &#8211; A quick start guide</a>&#8221;<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/hudson-ci-server-a-step-by-step-guide-part-i/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>NetBeans 6.7 &#8211; A quick glance</title>
		<link>http://solitarygeek.com/java/netbeans-6-7-a-quick-glance</link>
		<comments>http://solitarygeek.com/java/netbeans-6-7-a-quick-glance#comments</comments>
		<pubDate>Tue, 07 Jul 2009 15:30:58 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.solitarygeek.com/java/netbeans-netbeans-6-7/</guid>
		<description><![CDATA[<p>NetBeans 5.0 &#8211; Simplified Swing development NetBeans 5.5 &#8211; Simplified Java EE development NetBeans 6.0 &#8211; Made the NetBeans editor and other core infrastructure on par with competitors NetBeans 6.5 &#8211; Looked beyond Java development by supporting languages like PHP NetBeans 7.0 6.7 &#8211; Tries to make collaborative team development seamless.</p> <p>I was quick to download the &#8220;All Java&#8221; pack of NetBeans IDE for linux. Installation, as usual was pretty smooth on my Ubuntu 9.04. The installation didn&#8217;t give me much surprises and it was very much similar to version 6.5. I customized the installer to install Glassfish v2.1 and <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/netbeans-6-7-a-quick-glance">NetBeans 6.7 &#8211; A quick glance</a></span>]]></description>
			<content:encoded><![CDATA[<p><span>NetBeans 5.0 &#8211; Simplified Swing development<br />
NetBeans 5.5 &#8211; Simplified Java EE development<br />
NetBeans 6.0 &#8211; Made the NetBeans editor and other core infrastructure on par with competitors<br />
NetBeans 6.5 &#8211; Looked beyond Java development by supporting languages like PHP<br />
NetBeans <span style="text-decoration: line-through;">7.0</span> 6.7 &#8211; Tries to make collaborative team development seamless.</span></p>
<p><span>I was quick to download the &#8220;All Java&#8221; pack of <a href="http://www.netbeans.org/downloads/index.html">NetBeans</a> IDE for linux. Installation, as usual was pretty smooth on my Ubuntu 9.04. The installation didn&#8217;t give me much surprises and it was very much similar to version 6.5. I customized the installer to install Glassfish v2.1 and Tomcat 6.0.18 for me.</span></p>
<p><span><span id="more-36"></span><strong>Splash Screen</strong><br />
The splash screen has changed a bit and the startup was quick. But I wouldn&#8217;t comment about the startup speed at this point of time since I haven&#8217;t created/opened any projects in the IDE.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot1a.png" alt="" /></span></p>
<p><span><strong>Intuitive Start Page<br />
</strong>The start page has got the much needed face lift and is very attractive. The big and clean text reminded me about Eclipse which has got a really good start page. With this new start page, installing plugins is just one click away.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot2.png" alt="" /></span></p>
<p><span> </span><span>The start page also offers an intuitive way to activate/de-activate IDE features. Say suppose you don&#8217;t want certain IDE features, for example, Mobile development, it&#8217;s very easy to turn it off right from your start page. Good work!</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot3a.png" alt="" /></span></p>
<p><span><strong>Hudson Integration<br />
</strong>That&#8217;s my favourite feature in this release of NetBeans. <a href="http://hudson.dev.java.net">Hudson</a> is a great continuous integration server which helps you to automate your build process. And if your team uses Hudson, then this NetBeans feature might be very useful to you. As per my understanding, currently NetBeans supports only Hudson continuous integration server. If you are using other CI servers like CruiseControl, no great news for you in this release of NetBeans. <img src='http://solitarygeek.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </span></p>
<p><span><br />
</span></p>
<p><span>Open the &#8220;Services&#8221; window in the IDE and look for &#8220;Hudson Builders&#8221;. There you can add your existing hudson urls.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot5.png" alt="" /></span></p>
<p><span>With the hudson support, you can now manage the hudson jobs without opening a browser. You can even copy the build artifacts to your netbeans projects.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot6a.png" alt="" /></span></p>
<p><span>You can also watch the remote hudson build console at the comfort of your IDE.</span></p>
<p><span><strong>Issue Tracker Integration<br />
</strong>If you are doing any serious development, it&#8217;s most likely that you will be using some issue tracker. There are many popular issue trackers available like <a href="http://www.bugzilla.org/">Bugzilla</a>, <a href="http://trac.edgewall.org/">Trac</a>, <a href="http://www.atlassian.com/software/jira/">Jira</a> etc. NetBeans 6.7 provides out of the box support for Bugzilla but Jira support is available as well through a plugin.</span></p>
<p><span>I registered my mozilla issue tracker account in the IDE. Once an issue tracker is registered, you can find as well as add/modify issues.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot7.png" alt="" /></span></p>
<p><span>Finding issues from a bugzilla based issue tracking system is just a click away.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot8a.png" alt="" /></span></p>
<p><span>Reporting new issues is not a tough job either.</span></p>
<p><span><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot9a.png" alt="" /></span></p>
<p><span>I didn&#8217;t try the Jira integration yet. In future, I would love to see integration with more issue trackers like Trac.</span></p>
<p><span><strong>Error Reporting<br />
</strong>Another neat feature which I like in this release is the enhancements made to the exception reporter.<br />
In previous versions of NetBeans, the issue log file shall be uploaded to the netbeans server and you will be displayed a message in the browser regarding the status of the issue. Now that&#8217;s integrated into the IDE as well.</span></p>
<p><span><strong><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot10a.png" alt="" /></strong></span></p>
<p><span><strong></strong>You can view all the issues filed by you by clicking the button &#8220;Show my issues&#8221;. </span></p>
<p><span><strong><img style="max-width: 800px;" src="http://solitarygeek.com/blog/wp-content/uploads/2009/07/Screenshot11a.png" alt="" /><br />
</strong><br />
<strong>Others</strong></span></p>
<p><span><strong></strong>Other highlighed feature of NetBeans is &#8220;Project Kenai&#8221; integration. For those who are wondering what is this all about, &#8220;Project Kenai&#8221; is a place to host your open source projects much like sourceforge, google code, launchpad etc. But I couldn&#8217;t complete my testing on this NetBeans feature and as such I couldn&#8217;t write about this at this point of time. But to be frank, I&#8217;m not very excited about this feature. A sourceforge.net integration would have made me much happier but nevertheless it&#8217;s a great effort put forward by NetBeans team.</span></p>
<p><span>There are many other improvements in the areas of code completion, debugging, profiling, Maven support, Groovy support etc. You can get more details about that from the <a href="http://wiki.netbeans.org/NewAndNoteWorthyNB67">netbeans wiki</a>.</span></p>
<p><span><strong>Summary<br />
</strong>Overall, NetBeans 6.7 builds on the strong platform of 6.x series and takes team development one step further. Hudson integration is really very good and I believe Bugzilla integration is also pretty good. But there are not many new features in this release that can make a Java developer happy. Whatsoever, it&#8217;s a great effort from the NetBeans team and we must appreciate them for this solid work. So what about you? Have you tried NetBeans 6.7? How do you feel about it?</span></p>
<p><span><strong>New!</strong></span></p>
<p><span>Learn more about Hudson from the blog post <a href="http://www.solitarygeek.com/java/hudson-ci-server-a-step-by-step-guide-part-i/">Hudson CI Server &#8211; A step by step guide &#8211; Part I</a>.<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/netbeans-6-7-a-quick-glance/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Getting NetBeans ready for work on Ubuntu 8.10</title>
		<link>http://solitarygeek.com/java/getting-netbeans-ready-for-work-on-ubuntu-810</link>
		<comments>http://solitarygeek.com/java/getting-netbeans-ready-for-work-on-ubuntu-810#comments</comments>
		<pubDate>Wed, 04 Feb 2009 08:39:16 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://jamesselvakumar.wordpress.com/2009/02/04/getting-netbeans-ready-for-work-on-ubuntu-810/</guid>
		<description><![CDATA[<p>Now that you have upgraded from Windows to Ubuntu (like me ), let&#8217;s see how to setup NetBeans quickly on your new Ubuntu machine without wasting much time.</p> <p>Step 1: Install JDK</p> <p>Install jdk on your machine using the super easy install option in Ubuntu. Open the terminal and type:</p> sudo apt-get install sun-java6-jdk <p>This will install the latest jdk available in the Ubuntu repository. This is cool because, you need not worry about updating your jdk whenever a new release is available. Your system&#8217;s &#8220;Update Manager&#8221; will take care of the rest.</p> <p>Once the jdk is downloaded, you will <span style="color:#777"> . . . &#8594; Read More: <a href="http://solitarygeek.com/java/getting-netbeans-ready-for-work-on-ubuntu-810">Getting NetBeans ready for work on Ubuntu 8.10</a></span>]]></description>
			<content:encoded><![CDATA[<p>Now that you have upgraded from Windows to Ubuntu (like me <img src='http://solitarygeek.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ), let&#8217;s see how to setup NetBeans quickly on your new Ubuntu machine without wasting much time.</p>
<p><span id="more-262"></span><strong>Step 1: Install JDK</strong></p>
<p>Install jdk on your machine using the super easy install option in Ubuntu. Open the terminal and type:</p>
<div style="background: LightSteelBlue none repeat scroll 0pt 0pt; width: 300px;">
sudo apt-get install sun-java6-jdk</div>
<p>This will install the latest jdk available in the Ubuntu repository. This is cool because, you need not worry about updating your jdk whenever a new release is available. Your system&#8217;s &#8220;Update Manager&#8221; will take care of the rest.</p>
<p>Once the jdk is downloaded, you will be prompted to agree a license agreement in the terminal. Press &#8220;TAB&#8221; key to select the &#8220;Ok&#8221; option and then press &#8220;Enter&#8221;.</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3304/3252818081_dc82cd54eb_o.png" alt="" /></p>
<p>Next you will be shown another prompt, use your &#8220;arrow&#8221; keys to select &#8220;Yes&#8221; option and press &#8220;Enter&#8221; to start the install process.</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3399/3252818245_8dbb0410ff_o.png" alt="" /></p>
<p><strong>Step 2: Install NetBeans</strong></p>
<p>Verify whether jdk is installed on your machine by typing &#8220;java -version&#8221; in the terminal. If everything is ok, go and get yourself a copy of <a href="http://www.netbeans.org/downloads/index.html">netbeans installer</a>.</p>
<p>Once the netbeans installer is downloaded, right click the downloaded file (which should have &#8220;.sh&#8221; extension), click &#8220;Properties&#8221;, go to the &#8220;Permissions&#8221; tab and check the &#8220;Allow executing file as program&#8221; checkbox.</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3399/3253645022_828e388cce_o.png" alt="" /></p>
<p>Now double click the file and click &#8220;Run&#8221; to start the installation process.</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3433/3252818499_38a60bbde2_o.png" alt="" /></p>
<p><strong>Step 3: Start NetBeans with Nimbus Look and Feel</strong></p>
<p>Let&#8217;s face it. The default look and feel (GTK) of NetBeans on Ubuntu (and that of Ubuntu too) sucks. You probably don&#8217;t want your friends to ridicule your IDE and say &#8220;Is this NetBeans 1.0?&#8221;. You don&#8217;t want that, right?</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3266/3252818947_70be35a0da_o.png" alt="" /></p>
<p>But fortunately, there is a saviour in the form of &#8220;Nimbus&#8221; which is available from JDK 6 Update 10 onwards. And instructing NetBeans to start with &#8220;Nimbus&#8221; look and feel is very easy. Just right click your &#8220;NetBeans&#8221; icon on your desktop and click &#8220;Properties&#8221;. In the &#8220;Command&#8221; text field add the word &#8221; &#8211;laf Nimbus&#8221;.</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3123/3252819069_3881e01b13_o.png" alt="" /></p>
<p>In my case, it looks like:</p>
<div style="background: LightSteelBlue none repeat scroll 0pt 0pt; width: 550px;">
/bin/sh &#8220;/home/james/netbeans-6.5/bin/netbeans&#8221; &#8211;laf Nimbus</div>
<p>Now restart NetBeans to see your IDE skinned in Nimbus.</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3497/3252818709_829cc6592f_o.png" alt="" /></p>
<p><em>Tip:</em><br />
If you want NetBeans to look like other apps on your system, <a href="http://jamesselvakumar.wordpress.com/2009/01/29/nimbus-a-great-theme-for-ubuntu/">skin your Ubuntu with Nimbus</a> theme too.</p>
<p><strong>Step 4: Configure your video driver to ensure that NetBeans displays large files properly</strong></p>
<p>In a perfect world, you don&#8217;t need this step but unfortunately you might need to configure your video driver properly to ensure that NetBeans displays large files properly. Otherwise, your IDE editor might display large files like this when you scroll your mouse:</p>
<p><img style="max-width:800px;" src="http://wiki.netbeans.org/attach/FaqSolvingEditorGarbledText/bad_repaint_view_revision.png" alt="" /></p>
<p>Relax, <strong>this is not a bug in NetBeans</strong> but rather it&#8217;s just a little misconfiguration by Ubuntu. Fortunately, there is a solution to this issue and follow this <a href="http://wiki.netbeans.org/FaqSolvingEditorGarbledText">netbeans wiki</a> page to solve this.</p>
<p><strong>Step 5: Choose the right font for your editor</strong></p>
<p>Some of you might not like the default font used by the NetBeans editor on Ubuntu. For example, I like the crispy &#8220;Bitstream Vera Sans Mono&#8221; font with font size &#8220;13&#8243;. But if you are satisfied with the default editor font, it&#8217;s fine.</p>
<p><img style="max-width:800px;" src="http://farm4.static.flickr.com/3347/3252819181_9ca4eb8eda_o.png" alt="" /></p>
<p><strong>Step 6: Install path-tools plugin to integrate NetBeans with your filesystem browser</strong></p>
<p>I strongly recommend you to use the excellent &#8220;path-tools&#8221; plugin which help you to integrate your NetBeans IDE with the nautilus file manager in Ubuntu. With this plugin, you can easily navigate to your netbeans projects located in your filesystem. Go grab it from the <a href="http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=676">plugin portal</a>.</p>
<p>And don&#8217;t forget to install your favourite version control system like subversion, mercurial, git etc to enjoy the benefits offered by your IDE.</p>
<p>That&#8217;s it for now. It will be great to see your suggestions, comments and tips you employ on your Ubuntu machine. Enjoy..!</p>
]]></content:encoded>
			<wfw:commentRss>http://solitarygeek.com/java/getting-netbeans-ready-for-work-on-ubuntu-810/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

