<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Java Programming Forum - Learn Java Programming - Blogs - Eclipse</title>
		<link>http://www.java-forums.org/blogs/eclipse/</link>
		<description>Java Programming Forum - Learning Java easily</description>
		<language>en</language>
		<lastBuildDate>Sat, 25 May 2013 00:58:30 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.java-forums.org/images/misc/rss.jpg</url>
			<title>Java Programming Forum - Learn Java Programming - Blogs - Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/</link>
		</image>
		<item>
			<title>Working with SVN in Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/975-working-svn-eclipse.html</link>
			<pubDate>Wed, 29 Feb 2012 10:26:49 GMT</pubDate>
			<description>In a team work environment, using a version control system has been becoming standard approach to foster collaboration among team members, increase...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">In a team work environment, using a version control system has been becoming standard approach to foster collaboration among team members, increase productivity, centralize resources management, reduce risks and development time…<i>Subversion</i> (SVN) is a version control system which is very popular and widely used in software development, and <i>Subclipse</i> is an Eclipse plug-in that supports Subversion within the Eclipses IDE. <i>Subclipse</i> has been widely used to develop Java projects in Eclipse IDE for team-oriented working environments.<br />
<br />
This article will walk you from installing to using Subclipse for the most common tasks in terms of team collaboration. The version of Eclipse IDE targeted in this article is 3.7 – Indigo for Java EE developers.<br />
<br />
<b><font size="3">A brief overview about Subclipse</font></b><br />
<br />
Subclipse is an open-source Eclipse plug-in that supports working with Subversion servers within Eclipse IDE. It allows many developers working together on a project at the same time and synchronizing their work through a set of perspectives, views and functionalities. The project is managed by CollabNet, Inc – the firm started to develop Subversion as a replacement for CVS. Its home page can be touch at: <a href="http://subclipse.tigris.org/" target="_blank" rel="nofollow">http://subclipse.tigris.org/</a>. The latest version is 1.8.5 and it is working with Eclipse versions from 3.2 or higher. Subclipse can be installed from its update site via Eclipse’s <i>Install New Software</i> feature, or can be downloaded separately from its website to be installed locally.<br />
<br />
<br />
<b><font size="3">Install Subclipse in Eclipse</font></b><br />
<br />
The easiest way is to install Subclipse from its update site. Select <b>Help </b>-&gt; <b>Install New Software…</b> from Eclipse’s main menu. In the <i>Install </i>dialog, type the following URL into the text field <i>Work with</i>:<br />
<br />
<a href="http://subclipse.tigris.org/update_1.8.x" target="_blank" rel="nofollow">http://subclipse.tigris.org/update_1.8.x</a><br />
<br />
Hit Enter, Eclipse will load features available for the plug-in in the drop-down list, the <i>Subclipse</i> and <i>SVNKit</i>, as shown in the following screenshot:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3108d1330507738-xdoclet-hibernate-install-1.png" border="0" alt="Name:  install 1.png
Views: 1066
Size:  57.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select features of Subclipse to be installed</b></div><br />
Click <b>Select All</b>, and click <b>Next</b>. It may take a while for Eclipse to calculate requirements and dependencies before displaying the <i>Install Details</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3109d1330507886-xdoclet-hibernate-install-2.png" border="0" alt="Name:  install 2.png
Views: 1057
Size:  62.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Review the items to be installed</b></div><br />
Click <b>Next</b>, in the <i>Review Licenses</i> screen, select <i>I accept the terms of the license agreements</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3110d1330508025-xdoclet-hibernate-review-license.png" border="0" alt="Name:  review license.png
Views: 1068
Size:  63.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Accept the terms of the license agreements</b></div><br />
Click <b>Finish</b>, Eclipse is installing the software:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3111d1330508196-xdoclet-hibernate-installing-software.png" border="0" alt="Name:  installing software.png
Views: 1045
Size:  26.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Installation is in progress</b></div><br />
During the installation, a security warning pops up:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3112d1330508231-xdoclet-hibernate-security-warning.png" border="0" alt="Name:  security warning.png
Views: 1060
Size:  31.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Accept a security warning</b></div><br />
Click <b>OK</b>. After installation completed, Eclipse asks to restart the IDE or apply changes immediately:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3113d1330508280-xdoclet-hibernate-asks-restart.png" border="0" alt="Name:  asks restart.png
Views: 1046
Size:  22.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Restart the IDE after installation completed</b></div><br />
It is advisable to click <b>Restart Now</b>.<br />
<br />
<br />
<b><font size="3">Perspectives and Views for SVN</font></b><br />
<br />
Once installed, Subclipse provides two perspectives, one for SVN and one for team collaboration:<br />
<br />
<ul><li style="">    SVN Repositories Exploring</li><li style="">    Team Synchronizing</li></ul><br />
<br />
<br />
You can switch to the perspective by select <b>Window</b> -&gt; <b>Open Perspective…</b> -&gt; <b>Other</b>, and select one from the <i>Open Perspective</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3114d1330508609-xdoclet-hibernate-open-perspective.png" border="0" alt="Name:  open perspective.png
Views: 1035
Size:  31.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Open perspectives provivded by Subclipse</b></div><br />
The views provided by Subclipse can be found by selecting <b>Window </b>-&gt; <b>Show View</b> -&gt; <b>Other…</b> Expand the <i>SVN</i> branch:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3115d1330508687-xdoclet-hibernate-show-view.png" border="0" alt="Name:  show view.png
Views: 1051
Size:  26.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Views provided by Subclipse</b></div><br />
<br />
<b><font size="3">Check in a project to a SVN server</font></b><br />
<br />
Check in is the process of putting a project from a local computer to a SVN server. The project will be shared to other developers so that they can work on the project at the same time.<br />
<br />
Right click on to the project in <i>Project Explorer</i> view, and select <b>Team</b> -&gt;<b> Share Project…</b> from the context menu:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3116d1330508948-xdoclet-hibernate-share-project.png" border="0" alt="Name:  share project.png
Views: 1027
Size:  36.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Check in a project</b></div><br />
The<i> Share Project</i> dialog appears, select <b>SVN</b>, click <b>Next</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3117d1330509020-xdoclet-hibernate-share-project-dialog-1.png" border="0" alt="Name:  share project dialog 1.png
Views: 1029
Size:  28.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select SVN as repository type</b></div><br />
In the next screen, <i>Share Project with SVN Repository</i>, select<i> Create a new repository location</i>, click <b>Next</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3118d1330509100-xdoclet-hibernate-share-project-dialog-2.png" border="0" alt="Name:  share project dialog 2.png
Views: 1027
Size:  34.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a new repository location</b></div><br />
Type URL of the SVN repository into the <i>Url</i> field:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3119d1330509136-xdoclet-hibernate-share-project-dialog-3.png" border="0" alt="Name:  share project dialog 3.png
Views: 1018
Size:  29.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Type URL of the repository</b></div><br />
Click <b>Next</b>, in the next screen, you can specify the name of the folder in the SVN repository:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3120d1330509181-xdoclet-hibernate-share-project-dialog-4.png" border="0" alt="Name:  share project dialog 4.png
Views: 1015
Size:  30.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Enter folder name</b></div><br />
Click <b>Finish</b>. Note that you may have to enter user name and password to access the SVN repository, depending on the server’s settings.<br />
<br />
<br />
<b><font size="3">Check out a project from a SVN server</font></b><br />
<br />
Check out is the process of getting a project from a SVN server’s repository to local disk. There are two ways to check out a project in Eclipse:<br />
<br />
<ul><li style="">    Check out from menu File.</li><li style="">    Check out from SVN Repositories view.</li></ul><br />
<br />
<br />
<b>Check out from menu File</b><br />
<br />
Select <b>File</b> -&gt; <b>New</b> -&gt; <b>Project…</b> In the<i> New Project </i>dialog, expand <i>SVN</i> node and select <i>Check out projects from SVN</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3121d1330509340-xdoclet-hibernate-check-out-1.png" border="0" alt="Name:  check out 1.png
Views: 1018
Size:  42.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a new project from SVN</b></div><br />
Click <b>Next</b>, in the next screen, select <i>Create a new repository location</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3122d1330509555-xdoclet-hibernate-check-out-2.png" border="0" alt="Name:  check out 2.png
Views: 1019
Size:  36.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a new repository location</b></div><br />
Click <b>Next</b>, enter URL of the SVN repository into the <i>Url</i> field, and click <b>Next</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3123d1330509654-xdoclet-hibernate-check-out-3.png" border="0" alt="Name:  check out 3.png
Views: 1013
Size:  27.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Specify URL of the repository</b></div><br />
Eclipse will load content of the repository on the SVN server and ask you to select a project folder:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3124d1330509698-xdoclet-hibernate-check-out-4.png" border="0" alt="Name:  check out 4.png
Views: 1023
Size:  30.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select folder to be checked out</b></div><br />
Click <b>Next</b>, in the <i>Check Out As</i> screen, you can specify how to check out the project as a new project using the <i>New Project Wizard</i> or as a project in the current workspace. You can also select to check out a specific revision. Click <b>Finish</b> when done:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3125d1330509757-xdoclet-hibernate-check-out-5.png" border="0" alt="Name:  check out 5.png
Views: 1007
Size:  40.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Check out options</b></div><br />
The check out is in progress:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3126d1330509795-xdoclet-hibernate-check-out-progress.png" border="0" alt="Name:  check out in progress.png
Views: 992
Size:  29.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Eclipse is downloading project from SVN</b></div><br />
Note that you may be asked for providing user name and password to access the SVN repository.<br />
<br />
<br />
<b>Check out from SVN Repositories view</b><br />
<br />
Switch to <i>SVN Repository Exploring</i> perspective, in the view <i>SVN Repositories</i>, click on the <i>Add Repository</i> icon:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3127d1330509867-xdoclet-hibernate-add-svn-repo.png" border="0" alt="Name:  add svn repo.png
Views: 992
Size:  9.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Add SVN repository</b></div><br />
In the dialog<i> Add SVN Repository</i>, type URL of the SVN repository into <i>Url</i> field, and click <b>Finish</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3128d1330509929-xdoclet-hibernate-add-svn-repo-2.png" border="0" alt="Name:  add svn repo 2.png
Views: 1006
Size:  27.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Specify URL of the repository</b></div><br />
You may have to provide user name and password to access the SVN repository. Eclipse will load content of the repository in a hierarchical tree. Expand the repository node, and right click on the folder name which you want to check out:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3129d1330509980-xdoclet-hibernate-check-out-context-menu.png" border="0" alt="Name:  check out context menu.png
Views: 993
Size:  18.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Check out from context menu</b></div><br />
And follow the steps same as described above, for the <i>Check Out As</i> screen.<br />
<br />
<br />
<b><font size="3">Team collaboration tasks</font></b><br />
<br />
Subclipse provides a comprehensive context menu for team collaboration, it is the <i>Team</i> menu which can be found in the context menu:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3130d1330510135-xdoclet-hibernate-team-menu.png" border="0" alt="Name:  team menu.png
Views: 995
Size:  69.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Team context menu</b></div><br />
<br />
<b>Synchronize with Repository</b><br />
<br />
This task allows reviewing your changes with other team members in order to synchronize them. Select <b>Team</b> -&gt; <b>Synchronize with Repository</b> from context menu, Eclipse will switch you to <i>Team Synchronizing</i> perspective:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3131d1330510341-xdoclet-hibernate-team-synchronize-view.png" border="0" alt="Name:  team synchronize view.png
Views: 1142
Size:  154.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The Synchronize view</b></div><br />
In the <i>Synchronize </i>view you can take a look at:<br />
<br />
<ul><li style="">    <i>Outgoing changes</i>: changes made by you and ready to be committed. They are denoted by an outgoing arrow in gray.</li><li style="">    <i>Incoming changes</i>: changes made by other team members and ready to be updated. They are denoted by an incoming arrow in blue.</li><li style="">    <i>Conflicts</i>: are the resources that have been changed by someone while you are still working on them. Conflicts are denoted by a two-way arrow in red.</li></ul><br />
<br />
<br />
<br />
From the changes in the <i>Synchronize</i> view, you can decide to do by some quick commands in the context menu:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3132d1330510438-xdoclet-hibernate-quick-commands.png" border="0" alt="Name:  quick commands.png
Views: 986
Size:  24.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Quick commands in context menu</b></div><br />
<b>Commit</b><br />
<div style="margin-left:40px">    Push your changes to SVN repository. The dialog <i>Commit</i> appears, you can review what changes to commit and provide a comment, then click <b>OK</b>.</div><br />
<br />
<b>Update</b><br />
<div style="margin-left:40px">    Update the resource with a latest revision from the repository. A conflict will be notified if any.</div><br />
<br />
<b>Override and Update</b><br />
<div style="margin-left:40px">Always replace the content of the resource with a latest revision from the repository. If there is any conflict, you’re the local version is overridden by the revision from the repository.</div><br />
<br />
<b>Mark as Merged</b><br />
<div style="margin-left:40px">This command should be called to indicate that the current resource is merged with incoming changes from the repository. This is usually used after resolving conflicts.</div><br />
<br />
<b>Revert changes</b><br />
<div style="margin-left:40px">Undo the changes made to the resource since the last update.</div><br />
<br />
<b>Show History</b><br />
<div style="margin-left:40px">Review revision history of a resource. Details will be shown up in the History view, and you can switch back to a specific revision via context menu.</div><br />
<br />
Above are the most frequently used tasks. There are many other tasks which are waiting for you to explore.<br />
<br />
The <i>Synchronize</i> view comes with a handy toolbar that helps switching to incoming mode, outgoing mode, conflicts mode, update all incoming/outgoing changes…:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3133d1330510612-xdoclet-hibernate-toolbar.png" border="0" alt="Name:  toolbar.png
Views: 987
Size:  10.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Quick toolbar in Synchronize view</b></div><br />
The <i>Team Synchronization</i> perspective also provides a very useful compare editor which lets you to compare the local changes and remote changes visually:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/jdbc/3134d1330510886-xdoclet-hibernate-compare-editor.png" border="0" alt="Name:  compare editor.png
Views: 1019
Size:  61.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Code compare editor</b></div><br />
<br />
The compare editor is automatically loaded when double clicking on a resource, it is very helpful for resolving conflicts and merging changes.<br />
<br />
<br />
<b><font size="3">Conclusion</font></b><br />
<br />
Subclipse is a great plug-in for working with SVN and fostering team collaboration, so it should be one of must-have tools for any Java developers.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/975-working-svn-eclipse.html</guid>
		</item>
		<item>
			<title>Create new Form in Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/841-create-new-form-eclipse.html</link>
			<pubDate>Sat, 11 Feb 2012 13:59:29 GMT</pubDate>
			<description>Click the JFormDesigner button in toolbar of Eclipse. Also it can be initiated using following short keys. 
•	For Windows (Ctrl+Shift+V) 
•	For Mac...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Click the JFormDesigner button in toolbar of Eclipse. Also it can be initiated using following short keys.<br />
•	For Windows (Ctrl+Shift+V)<br />
•	For Mac (Shift+Command+V)<br />
<br />
To create a new form using Eclipse’s Package Explorer, select destination folder and right click. It will open following dialog box.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2982d1328968742-how-create-file-1.jpg" border="0" alt="Name:  1.JPG
Views: 4177
Size:  52.8 KB" class="thumbnail" style="float:CONFIG" /></div><b><div style="text-align: center;"><br />
Create new Form in Eclipse</div></b></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/841-create-new-form-eclipse.html</guid>
		</item>
		<item>
			<title>Benefits of using Eclipse Plug-ins</title>
			<link>http://www.java-forums.org/blogs/eclipse/840-benefits-using-eclipse-plug-ins.html</link>
			<pubDate>Sat, 11 Feb 2012 13:56:22 GMT</pubDate>
			<description>Eclipse Plug-ins provides following benefits as compared to other development environments. 
 
•	Integrated editor to create and design in Eclipse....</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Eclipse Plug-ins provides following benefits as compared to other development environments.<br />
<br />
•	Integrated editor to create and design in Eclipse.<br />
•	It uses current project’s source folders and classpath.<br />
•	When you make changes in design, it changes in code accordingly.<br />
•	In Java editor, you can fold generated Java code.<br />
•	In Java editor, you can navigate to event handlers.<br />
•	Strings in designer and properties file have two way synchronization. <br />
•	Copy and paste libraries to include in classpath.<br />
•	Integrated with version control system.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/840-benefits-using-eclipse-plug-ins.html</guid>
		</item>
		<item>
			<title>Conditional breakpoints in Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/839-conditional-breakpoints-eclipse.html</link>
			<pubDate>Sat, 11 Feb 2012 13:55:06 GMT</pubDate>
			<description>To debug a Java Program in Eclipse, it allow to setup “conditional break points”.  Conditional break points are based on conditions. Your debugging...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">To debug a Java Program in Eclipse, it allow to setup “conditional break points”.  Conditional break points are based on conditions. Your debugging thread will stop when the specified condition is matched at the break point line. <br />
<br />
To setup a new conditional break point follow these steps.<br />
<br />
•	Double click on the required line in your code on which you are interested to setup break point.<br />
•	Right click -&gt; Properties -&gt; Insert condition.<br />
<br />
The program will stop on this line when the entered condition matched and program is running in debug mode.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2981d1328968473-how-create-file-1.jpg" border="0" alt="Name:  1.JPG
Views: 132
Size:  49.1 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">Conditional breakpoints in Eclipse</div></b></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/839-conditional-breakpoints-eclipse.html</guid>
		</item>
		<item>
			<title>Increasing Eclipse Memory’s setting for Android Project</title>
			<link>http://www.java-forums.org/blogs/eclipse/838-increasing-eclipse-memory-s-setting-android-project.html</link>
			<pubDate>Sat, 11 Feb 2012 13:49:49 GMT</pubDate>
			<description>The Android project has a large size and it causes memory issues while compiling this project.  To avoid such memory issues, increase memory size. To...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">The Android project has a large size and it causes memory issues while compiling this project.  To avoid such memory issues, increase memory size. To increase the memory size, edit “eclipse.ini” file.  This file is located at following location:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Default memory parameters are as shown below.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">-Xms40m 
-Xmx256m 
-XX:MaxPermSize=256m</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Following settings are recommended for Android development.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">-Xms128m 
-Xmx512m 
-XX:MaxPermSize=256m</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 The above settings set minimum memory size to 128 MB. The maximum size set in the above code is 512 MB. <br />
<br />
After setting these memory parameters, restart Eclipse.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/838-increasing-eclipse-memory-s-setting-android-project.html</guid>
		</item>
		<item>
			<title>Eclipse Remote Debugging</title>
			<link>http://www.java-forums.org/blogs/eclipse/837-eclipse-remote-debugging.html</link>
			<pubDate>Sat, 11 Feb 2012 13:46:21 GMT</pubDate>
			<description><![CDATA[Follow these steps to set up remote debugging in Eclipse. 
 
•	Open your java project. 
•	Select project. 
•	Click Run -> Debug Configurations as...]]></description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Follow these steps to set up remote debugging in Eclipse.<br />
<br />
•	Open your java project.<br />
•	Select project.<br />
•	Click Run -&gt; Debug Configurations as shown below.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2978d1328967796-how-can-i-get-list-files-directory-1.jpg" border="0" alt="Name:  1.JPG
Views: 309
Size:  12.5 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">Debug Configurations</div></b><br />
<br />
•	A new dialog box will open with different configuration options. Select “Remote Java Application as shown below.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2979d1328967843-how-can-i-get-list-files-directory-1.jpg" border="0" alt="Name:  1.JPG
Views: 346
Size:  19.2 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">Debug Configurations Option with Remote Java Application</div></b><br />
<br />
•	Click “New”, it will create new configurations for your project. Setup host and port for your debugging.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2980d1328967876-how-can-i-get-list-files-directory-1.jpg" border="0" alt="Name:  1.JPG
Views: 92
Size:  25.3 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">New Debug Configurations</div></b></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/837-eclipse-remote-debugging.html</guid>
		</item>
		<item>
			<title>Eclipse Memory Analyzer (MAT)</title>
			<link>http://www.java-forums.org/blogs/eclipse/836-eclipse-memory-analyzer-mat.html</link>
			<pubDate>Sat, 11 Feb 2012 13:41:26 GMT</pubDate>
			<description>Eclipse Memory analyzer (MAT) is used to analyze memory leaks in your application. If an object has no reference, it is released by Java Garbage...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Eclipse Memory analyzer (MAT) is used to analyze memory leaks in your application. If an object has no reference, it is released by Java Garbage Collector.  In a situation you get OutOfMemoryError, you can instruct Java Virtual Machine to create heap dump.  The Eclipse Memory Analyzer provides a visual image of Java heap dump and helps to identify memory leaks.  Use the following command to guide JVM to create a heapdump.<br />
<br />
XX:+HeapDumpOnOutOfMemoryError<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2977d1328967643-how-search-files-java-1.jpg" border="0" alt="Name:  1.JPG
Views: 385
Size:  36.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<br />
<b>Eclipse Memory Analyzer (MAT)</b></div><br />
To install Eclipse Memory Analyzer using Eclipse Update Manager, open General Purpose Tools and then install Memory Analyzer.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/836-eclipse-memory-analyzer-mat.html</guid>
		</item>
		<item>
			<title>Installing Eclipse Plug-ins</title>
			<link>http://www.java-forums.org/blogs/eclipse/835-installing-eclipse-plug-ins.html</link>
			<pubDate>Sat, 11 Feb 2012 13:38:16 GMT</pubDate>
			<description>Eclipse is an extendible integrated development environment, which is open source platform and supports integration of new plug-ins. Eclipse supports...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Eclipse is an extendible integrated development environment, which is open source platform and supports integration of new plug-ins. Eclipse supports building of new tools that can be integrated with it. Other than core runtime environment, everything in Eclipse is a plug-in. All the plug-ins are developed and integrated in almost same way.<br />
<br />
In this section, we will discuss on installing an Eclipse plug-in. below image shows the Eclipse SDK folder.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2974d1328967396-how-always-show-last-line-my-jtextarea-1.jpg" border="0" alt="Name:  1.JPG
Views: 240
Size:  4.9 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">Eclipse SDK folder</div></b><br />
<br />
The folder hierarchy looks like following when you extract the Webtools package.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2975d1328967440-how-always-show-last-line-my-jtextarea-1.jpg" border="0" alt="Name:  1.JPG
Views: 43
Size:  2.9 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">Webtools package</div></b><br />
<br />
Copy the contents of the folders as shown below.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/new-java/2976d1328967468-how-always-show-last-line-my-jtextarea-1.jpg" border="0" alt="Name:  1.JPG
Views: 38
Size:  8.8 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">Installing Eclipse Plug-ins</div></b></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/835-installing-eclipse-plug-ins.html</guid>
		</item>
		<item>
			<title>Eclipse Plug-in Deployment</title>
			<link>http://www.java-forums.org/blogs/eclipse/834-eclipse-plug-deployment.html</link>
			<pubDate>Sat, 11 Feb 2012 13:33:49 GMT</pubDate>
			<description>To deploy an Eclipse plug-in, deploy following into Eclipse intallation’s plug-in folder. 
 
•	Manifest File 
•	Jar Files 
•	Any other resources 
...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">To deploy an Eclipse plug-in, deploy following into Eclipse intallation’s plug-in folder.<br />
<br />
•	Manifest File<br />
•	Jar Files<br />
•	Any other resources<br />
<br />
Now Eclipse can activate this plug-in when it is required to perform some functionality. To activate a plug-in:<br />
<br />
•	Load runtime class<br />
•	Instantiate it<br />
•	Initialize it<br />
<br />
Plug-in class is responsible for doing special tasks like allocation and reallocation of resources. For some simple plug-ins this activation and deactivation is not required and also plug-in class is not required in such cases. Eclipse runtime provides a default class in such cases.<br />
<br />
Activation and deactivation methods are overridden by the org.eclipse.core.runtime.Plugin subclasses in order to perform some specific tasks at time of activation and deactivation. <br />
<br />
Eclipse deployment consists of a management kernel called Eclipse platform and a certain core plug-ins. These are hard-coded plug-ins in the Eclipse environment and platform activates these plug-ins. <br />
<br />
Remaining plug-ins which are not core are activated when they are required.<br />
<br />
A plug-in may have one of the following relations with other plug-in in the Eclipse model.<br />
<br />
•	Dependency: Main roles are<br />
<div style="margin-left:40px">o	Dependent plug-in<br />
o	Prerequisite plug-in	</div>•	Extension: Main roles are <br />
<div style="margin-left:40px">o	Host plug-in<br />
o	Extender plug-in</div><br />
Plug-in manifest file contains the declaration of these relationships.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/834-eclipse-plug-deployment.html</guid>
		</item>
		<item>
			<title>The Eclipse Plug-in Model</title>
			<link>http://www.java-forums.org/blogs/eclipse/833-eclipse-plug-model.html</link>
			<pubDate>Sat, 11 Feb 2012 13:31:54 GMT</pubDate>
			<description>Plug-in is a component that supports a particular service or functionality in the Eclipse workbench. This component can be integrated into system at...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Plug-in is a component that supports a particular service or functionality in the Eclipse workbench. This component can be integrated into system at deployment time. Eclipse supports a wide variety of these plug-ins that can work together to support an environment for development. A plug-in in Eclipse is embodied in plug-in runtime class instance. This class provides some configuration functionality for the plug-in instance. A plug-in class must extend org.eclipse.core.runtime.Plugin which is an abstact class and it supports functions for managing plug-ins.<br />
<br />
Each Eclipse installation contains a folder, where these plug-ins are deployed. Each plug-in is installed in its own separate folder. An XML manifest file is used to describe plug-in. This file is called “calledplugin.xml” and it resides in the plug-in folder. This file contains useful information for Eclipse to activate this plug-in.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/833-eclipse-plug-model.html</guid>
		</item>
		<item>
			<title>Develop a Java EE Application in Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/832-develop-java-ee-application-eclipse.html</link>
			<pubDate>Sat, 11 Feb 2012 13:30:41 GMT</pubDate>
			<description>*1.	Setup Eclipse for Web Development* 
 
•	Install Eclipse for Java EE 
•	Install a web server like tomcat of glassfish 
•	Configure web server in...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore"><b>1.	Setup Eclipse for Web Development</b><br />
<br />
•	Install Eclipse for Java EE<br />
•	Install a web server like tomcat of glassfish<br />
•	Configure web server in your Eclipse<br />
<div style="margin-left:40px">o	Launch Eclipse-&gt;Window-&gt;Preference-&gt;Server Node-&gt;Runtime Environment-&gt;Add-&gt;Expand Apache and add tomcat</div><br />
<b>2.	Hello Word JSP</b><br />
<br />
•	Create a new Web Application<br />
<div style="margin-left:40px">o	File-&gt;New-&gt;Dynamic Web Project<br />
o	Enter “HelloJSP” as project name and enter finish</div>•	Create new JSP page<br />
<div style="margin-left:40px">o	Right click on your project<br />
o	New-&gt;Jsp File and enter “Hello” in file name</div><br />
<b>3.	Create a Servlet</b><br />
<br />
•	Create a new Web Application: <br />
<div style="margin-left:40px">o	File -&gt; New -&gt; Dynamic Web Project <br />
o	Write HelloServlet in project name</div>•	Create a new Servlet: <br />
<div style="margin-left:40px">o	Right click on the project<br />
o	New -&gt; Servlet -&gt; In &quot;Java Package&quot;, enter &quot;hello&quot;<br />
o	In &quot;Class Name&quot;, enter &quot;HelloServlet&quot; <br />
o	In &quot;URL Mappings&quot;, select &quot;\HelloServlet&quot;, </div></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/832-develop-java-ee-application-eclipse.html</guid>
		</item>
		<item>
			<title>Eclipse Architecture</title>
			<link>http://www.java-forums.org/blogs/eclipse/831-eclipse-architecture.html</link>
			<pubDate>Sat, 11 Feb 2012 13:24:02 GMT</pubDate>
			<description>Eclipse is based on plug-ins and uses them to provide core functionality as compared to different other application where hard coded functionality is...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Eclipse is based on plug-ins and uses them to provide core functionality as compared to different other application where hard coded functionality is normally used. Eclipse is based on a runtime system called Equinox that is an implementation of OSGi core framework specification.<br />
This plug-ins is software components that allow Eclipse to extend using other languages like Python or C. Also this plug-ins provides support to work with network applications. Using this plug-ins, you can write extension to Eclipse environment. For example CVS and Java is supported in Eclipse with many other third party plug-ins based version control systems.<br />
<br />
At the core of Eclipse is a small run-time kernel. Everything other than this kernel is a plug-in. This plug-ins is integrated with Eclipse in same way like other plug-ins is integrated. This makes all new features are created equal. Eclipse has a support for large variety of plug-ins, for example UML plug-in for UML diagrams and DB Explorer etc.<br />
<br />
•	The Eclpse SDK includes following:<br />
•	Eclipse Java Development Tools<br />
•	Java compiler<br />
•	Full model of the Java source file.<br />
<br />
It supports code analysis and advanced level refactoring of code. Eclipse also supports use of workspace where a set of metadata allows external file modifications.<br />
<br />
For Java, widget toolkit is implemented by Eclipse that is called SWT. Many other Java applications uses AWT or swing but Eclipse uses a GUI layer called JFace which support building of applications based on SWT.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/831-eclipse-architecture.html</guid>
		</item>
		<item>
			<title>What is Eclipse?</title>
			<link>http://www.java-forums.org/blogs/eclipse/830-what-eclipse.html</link>
			<pubDate>Sat, 11 Feb 2012 13:22:39 GMT</pubDate>
			<description>Eclipse is an integrated development environment (IDE) that provides a software development environment and supports plug-ins. Eclipse is developed...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Eclipse is an integrated development environment (IDE) that provides a software development environment and supports plug-ins. Eclipse is developed mostly in Java and it is used to develop Java applications with the help of plug-ins. Eclipse is also know as Eclipse ADT(Ada Development Toolkit) for Ada, for C/C++ it is called CDT, for Java it is called JDT and for PHP it is called PDT.<br />
<br />
It is released under Eclipse Public License; it is open source and free software. Below figure shows a snapshot of Eclipse.<br />
<div style="text-align: center;"><br />
<img src="http://www.java-forums.org/attachments/java-software/2973d1328966520-agilerss-3-0-1-1.jpg" border="0" alt="Name:  1.JPG
Views: 161
Size:  41.7 KB" class="thumbnail" style="float:CONFIG" /></div><br />
<b><div style="text-align: center;">Eclipse IDE</div></b></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/830-what-eclipse.html</guid>
		</item>
		<item>
			<title>Start writing a plug-in for Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/796-start-writing-plug-eclipse.html</link>
			<pubDate>Mon, 06 Feb 2012 04:13:12 GMT</pubDate>
			<description>The Eclipse IDE has an open architecture which allows third party developers to extend or add new functionalities to the Eclipse’s core platform....</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">The Eclipse IDE has an open architecture which allows third party developers to extend or add new functionalities to the Eclipse’s core platform. This architecture follows the <i>OSGi</i> framework which is a specification for application and component life cycle management.<br />
<br />
This article will guide you to develop a sample plug-in from creating fundamental blocks to testing and installing as a feature to the IDE. The version of Eclipse targeted by this article is the 3.7 (Indigo).<br />
<br />
Before getting started, let’s get familiar with some fundamental concepts regarding the plug-in development in Eclipse.<br />
<br />
<br />
<b><font size="3">Fundamental Concepts about plug-ins for Eclipse</font></b><br />
<br />
<ul><li style="">    <i>PDE</i>:  stands for <i>Plug-in Development Environment</i>, PDE provides necessary tools to help developers creating, developing, debugging, testing and deploying components for Eclipse IDE such as plug-ins, features, update sites… The PDE provided by Eclipse is very powerful, flexible and easy to use.</li><li style="">    <i>Plug-in</i>: A plug-in is a smallest unit that represents a group of code which is modular, extendable and shareable. Plug-ins are the basic parts that make up of an Eclipse based program or product. Think a plug-in as a modular part of a program.</li><li style="">    <i>Extensions</i> and <i>Extension points</i>: An extension is a way for a plug-in to extend a functionality of another plug-in through its extension point. An extension point is declared by a plug-in to allow another plug-in extends its functionality. Think extensions as interfaces that allow plug-ins to work together.</li><li style="">    <i>Feature</i>: A feature is used to group some plug-ins together into a single unit which is installable and updatable. A product or program can contain several features.</li><li style="">    <i>Update Site</i>: An update site is used to organize features so that they can be installed into Eclipse IDE. Update sites can be on a local computer on a remote server and it is the widely used way to deliver Eclipse based products.</li></ul><br />
<br />
<br />
There are other terms such as <i>fragment, product,</i> and <i>target platform</i> but for the purpose of this article, the terms described above is enough for you to start. For other terms, refer to Eclipse’s documentation.<br />
<br />
<br />
<b><font size="3">Activate the PDE</font></b><br />
<br />
The PDE is provided as a perspective in the IDE. Select <b>Window</b> -&gt; <b>Open Perspective</b> -&gt; <b>Other…</b> from Eclipse’s main menu, and choose <i>Plug-in Development</i> from the <i>Open Perspective</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2902d1328497557-safebox-3-35-open-perspective.png" border="0" alt="Name:  open perspective.PNG
Views: 258
Size:  11.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Open the Plug-in Development perspective</b></div><br />
The <i>Plug-in Development</i> perspective has the following views:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2903d1328497630-safebox-3-35-views.png" border="0" alt="Name:  views.PNG
Views: 250
Size:  10.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The views of Plug-in Development perspective</b></div><br />
The <b>New</b> menu is also customized for creating plug-in related items:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2904d1328497696-safebox-3-35-new-menu.png" border="0" alt="Name:  new menu.PNG
Views: 259
Size:  24.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: New menu is customized for PDE</b></div><br />
The following screenshot illustrates the <i>Plug-in Development</i> perspective for a plug-in project:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2905d1328497764-safebox-3-35-pde.png" border="0" alt="Name:  pde.PNG
Views: 271
Size:  142.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The Plug-in Development perspective</b></div><br />
<br />
<b><font size="3">Creating a Eclipse plug-in project</font></b><br />
<br />
We are going to develop a plug-in project that adds a custom menu to the main menu.<br />
<br />
Select <b>File</b> -&gt; <b>New</b> -&gt; <b>Plug-in Project</b> from the main menu. In the <i>Plug-in Project</i> screen, type <i>MyPlugin</i> as the <i>Project name</i>. In the <i>Target Platform</i> section, select <i>Eclipse version</i> and select <i>3.6</i> from the dropdown list. The plug-in we are going to create will be run on Eclipse 3.6 or later:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2906d1328498023-safebox-3-35-plugin-project-1.png" border="0" alt="Name:  Plugin project 1.PNG
Views: 260
Size:  25.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a new Plug-in project</b></div><br />
Click <b>Next</b>. In the Content screen:<br />
<br />
<ul><li style="">    Keep <span style="font-family: Courier New"><font size="2">1.0.0</font></span> as <i>Version</i> (delete the word qualifier).</li><li style="">    Type <span style="font-family: Courier New"><font size="2">My Company</font></span> as <i>Provider</i>.</li><li style="">    In the dropdown list <i>Execution Environment</i>, select the JavaSE version available on your computer.</li></ul><br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2907d1328498137-safebox-3-35-plugin-project-2.png" border="0" alt="Name:  Plugin project 2.PNG
Views: 260
Size:  24.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Specify content for new plug-in project</b></div><br />
Leave others as default, and click <b>Next</b>. In the <i>Templates</i> screen, uncheck the option <i>Create a plug-in using one of the templates</i>, as we will add an extension later.<br />
<br />
Click <b>Finish</b>, Eclipse creates some skeleton stuff for the project, note the <span style="font-family: Courier New"><font size="2">Activator.java</font></span> class is created under <span style="font-family: Courier New"><font size="2">src -&gt; myplugin</font></span> directory. This class is to control the plug-in life cycle:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2909d1328498511-safebox-3-35-plugin-project.png" border="0" alt="Name:  the plugin project.PNG
Views: 270
Size:  83.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The generated Activator class</b></div><br />
Eclipse created the necessary skeleton code, and normally we don’t need to modify this class.<br />
And note the new editor page:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2908d1328498308-safebox-3-35-plugin-editor.png" border="0" alt="Name:  plugin editor.PNG
Views: 305
Size:  50.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The plug-in editor</b></div><br />
This editor allows developers to control everything about a plug-in which is separated into individual pages such as <i>Overview, Dependencies, Runtime, Extensions…</i>This makes configuring and managing the plug-in easily.<br />
<br />
<b><font size="3">Creating an extension for custom menu</font></b><br />
<br />
Now let’s add something interesting to the plug-in. Select page <i>Extensions</i> in the <i>MyPlugin</i> tab, and click on the <b>Add</b> button:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2910d1328498607-safebox-3-35-add-extension-1.png" border="0" alt="Name:  add extension 1.PNG
Views: 256
Size:  15.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Add an extension</b></div><br />
In the <i>New Extension</i> dialog, select the tab <i>Extension Wizards</i>, and choose the <i>“Hello, World”</i> action set on the right:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2911d1328498701-safebox-3-35-new-extension-1.png" border="0" alt="Name:  new extension 1.PNG
Views: 250
Size:  29.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select an extension wizard</b></div><br />
Click <b>Next</b>, in the next screen, type the following information:<br />
<br />
<ul><li style="">    <span style="font-family: Courier New"><font size="2">MyAction</font></span> for <i>Action Class Name</i>.</li><li style="">    <span style="font-family: Courier New"><font size="2">Greetings, thank you for using my plugin</font></span> for <i>Message Box Text</i>.</li></ul><br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2912d1328498862-safebox-3-35-new-extension-2.png" border="0" alt="Name:  new extension 2.PNG
Views: 249
Size:  16.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Specify information for the action</b></div><br />
Click <b>Finish</b>. Eclipse has created two things:<br />
<br />
<ul><li style="">    The <span style="font-family: Courier New"><font size="2">plugin.xml</font></span> file: holds configuration for the plug-in.</li><li style="">    The <span style="font-family: Courier New"><font size="2">MyAction.java</font></span> class: implements the behavior when the menu is clicked. This class implements the <span style="font-family: Courier New"><font size="2">IWorkbenchWindowActionDelegate</font></span> interface and overrides some methods. The code to display the message is in the <span style="font-family: Courier New"><font size="2">run()</font></span> method.</li></ul><br />
<br />
Select the <i>Sample Menu (menu)</i> under the <i>Sample Action Set (actionSet)</i> in the <i>All Extensions</i> section.<br />
<br />
In the section <i>Extension Element Details</i>, type <i>myMenu</i> for <i>id</i>, and <i>My Menu</i> for <i>label</i>, like the following screenshot:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2913d1328499064-safebox-3-35-edit-sample-menu.png" border="0" alt="Name:  edit sample menu.PNG
Views: 246
Size:  21.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure menu</b></div><br />
Select the <i>Sample Action (action)</i>, type <i>myAction</i> for <i>id</i> and <i>My Action</i> for <i>label</i>. Press <b>Ctrl + S</b> to save the changes to the project.<br />
<br />
<br />
<b><font size="3">Testing the plug-in in Eclipse</font></b><br />
<br />
The PDE allows developers to test their plug-in project with a single mouse click. Select page <i>Overview</i>, click <i>Launch Eclipse application</i> under the <i>Testing </i>section:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2914d1328499424-safebox-3-35-testing.png" border="0" alt="Name:  testing.PNG
Views: 257
Size:  47.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Click Launch an Eclipse application</b></div><br />
Eclipse will launch a separate instance for testing. You will see a custom menu <i>My Menu</i> is added to the main menu, with a menu item <i>My Action</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2915d1328499501-safebox-3-35-test-menu.png" border="0" alt="Name:  test menu.PNG
Views: 249
Size:  30.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Test the action of the plug-in</b></div><br />
Select <b>My Menu </b>-&gt; <b>My Action</b>, a message box appears:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2916d1328499563-safebox-3-35-message-box.png" border="0" alt="Name:  message box.PNG
Views: 232
Size:  6.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The message dialog</b></div><br />
It is great, right? So far you don’t have to write any code at all. Eclipse automatically generates almost the code for you. Have a look at the <span style="font-family: Courier New"><font size="2">plugin.xml</font></span> file to see how Eclipse generates the XML declaration for the plug-in:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2917d1328499637-safebox-3-35-plugin-xml.png" border="0" alt="Name:  plugin xml.PNG
Views: 260
Size:  25.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Content of the plugin.xml</b></div><br />
And if you want to modify some code, look at the generated classes <span style="font-family: Courier New"><font size="2">MyAction.java</font></span> and <span style="font-family: Courier New"><font size="2">Activator.java</font></span>.<br />
<br />
<br />
<b><font size="3">Creating a feature project</font></b><br />
<br />
Till now we have a plug-in project that works. Next, we need to create a feature project that covers the plug-in and turns it into an installable unit.<br />
Select <b>File </b>-&gt; <b>New </b>-&gt; <b>Feature Project</b> from the main menu. In the<i> New Feature </i>dialog:<br />
<br />
<ul><li style="">    Type <span style="font-family: Courier New"><font size="2">MyFeature</font></span> as <i>Project </i>name.</li><li style="">    Keep <span style="font-family: Courier New"><font size="2">1.0.0</font></span> as<i> Feature Version</i> (delete the word <span style="font-family: Courier New"><font size="2">qualifier</font></span>).</li><li style="">    Type <span style="font-family: Courier New"><font size="2">My Company</font></span> as <i>Feature Provider</i>.</li></ul><br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2918d1328499931-safebox-3-35-new-feature-1.png" border="0" alt="Name:  new feature 1.PNG
Views: 243
Size:  21.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a Feature project</b></div><br />
Click <b>Next</b>. In the next screen, select option <i> Initialize from the plug-ins list</i>, then select the item <i>MyPlugin</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2919d1328500017-safebox-3-35-new-feature-2.png" border="0" alt="Name:  new feature 2.PNG
Views: 244
Size:  27.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Add a plug-in to the feature</b></div><br />
Click <b>Finish</b>, Eclipse creates the <i>MyFeature </i>project:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2920d1328500084-safebox-3-35-my-feature-project.png" border="0" alt="Name:  my feature project.PNG
Views: 247
Size:  63.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Feature editor</b></div><br />
There are only two files created for this project: <span style="font-family: Courier New"><font size="2">build.properties</font></span> and <span style="font-family: Courier New"><font size="2">feature.xml</font></span>. The <span style="font-family: Courier New"><font size="2">feature.xml</font></span> file contains various definitions for the feature such as the plug-in it wraps, copyright and license information.<br />
<br />
Select the <span style="font-family: Courier New"><font size="2">feature.xml</font></span> page, type some information for the description, copyright and license, as in the screenshot below:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2921d1328500188-safebox-3-35-feature-xml.png" border="0" alt="Name:  feature xml.PNG
Views: 250
Size:  23.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Content of feature.xml</b></div><br />
Press <b>Ctrl + S </b>to save the project.<br />
<br />
The <i>Plug-ins</i> page allows managing which plug-ins are included in the feature:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2922d1328500289-safebox-3-35-feature-plugins.png" border="0" alt="Name:  feature plugins.PNG
Views: 251
Size:  28.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Plug-ins added to the feature</b></div><br />
Here we see the <i>MyPlugin </i>is included because we selected it previously in the <i>New Feature </i>wizards.<br />
<br />
<br />
<b><font size="3">Creating an update site project</font></b><br />
<br />
This is the last step to create a deployable and installable unit. In the editor for <i>MyFeature</i>, select <i>Overview </i>page, then click <i>Create an Update Site Project</i>, in the <i>Publishing </i>section:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2923d1328500539-safebox-3-35-create-update-site-project.png" border="0" alt="Name:  create update site project.PNG
Views: 248
Size:  41.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Click Create an Update Site Project</b></div><br />
The <i>New Update Site</i> dialog appears, type <i>MyUpdateSite </i>as <i>Project name</i>, then click <b>Finish</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2924d1328500627-safebox-3-35-new-update-site.png" border="0" alt="Name:  new update site.PNG
Views: 250
Size:  18.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create an Update Site project</b></div><br />
The project <i>MyUpdateSite </i>is created with a <span style="font-family: Courier New"><font size="2">site.xml</font></span> file and an editor <i>Update Site Map</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2925d1328500710-safebox-3-35-update-site-project.png" border="0" alt="Name:  update site project.PNG
Views: 259
Size:  18.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Update Site Map editor</b></div><br />
Click<b> Add Feature</b>, the <i>Feature Selection</i> dialog appears, select <i>MyFeature </i>in the drop-down list, and click <b>OK</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2926d1328500781-safebox-3-35-feature-selection.png" border="0" alt="Name:  feature selection.PNG
Views: 249
Size:  15.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Add a feature to the site</b></div><br />
The feature <i>MyFeature </i>is added under the section <i>Managing the Site</i>. Click <b>Build All</b> button to build the projects <i>MyFeature </i>and <i>MyPlugin</i>. Some artifacts are created under <i>MyUpdateSite </i>project, as shown in the following screenshot:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2927d1328500872-safebox-3-35-after-build.png" border="0" alt="Name:  after build.PNG
Views: 250
Size:  22.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Artifacts created after build</b></div><br />
The JAR files created, along with the <span style="font-family: Courier New"><font size="2">site.xml</font></span> file, are ready for installing.<br />
<br />
<br />
<b><font size="3">Install the feature to Eclipse</font></b><br />
<br />
Now close all the projects, exit the IDE and re-launch Eclipse. We are going to install the plug-in created as a feature.<br />
<br />
Select <b>Help </b>-&gt;<b> Install New Software</b> from the main menu. In the <i>Install </i>dialog, click <b>Add </b>button. In the <i>Add Repository dialog</i>, type<i> My Company</i> into the <i>Name </i>field and click <b>Local </b>button. Select the directory of the <i>MyUpdateSite </i>project, and click <b>OK</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2928d1328501112-safebox-3-35-install-feature.png" border="0" alt="Name:  install feature.PNG
Views: 247
Size:  39.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Install feature from local site</b></div><br />
Click <b>OK </b>in the <i>Add Repository</i> dialog. Click <b> Select All</b> in the <i>Install </i>dialog to choose the feature to be installed, and click <b>Next</b>.<br />
<br />
In the next screen, <i>Install Details</i>, click <b>Next</b>. In the <i>Review Licenses</i> screen, select<i> I accept the terms of the license agreement</i>, and click <b>Finish</b>. Eclipse is now installing the software:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2929d1328501214-safebox-3-35-install-software.png" border="0" alt="Name:  install software.PNG
Views: 244
Size:  9.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The feature is being installed</b></div><br />
Eclipse may display a security warning dialog, click <b>OK</b>. Finally Eclipse asks to restart or apply change, click <b>Apply Changes Now</b>.<br />
<br />
Immediately a new menu is added to the Eclipse’s main menu, <i>My Menu</i>. Select <b>My Menu</b> -&gt; <b>My Action</b>, a message dialog appears:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2930d1328501299-safebox-3-35-run-plugin.png" border="0" alt="Name:  run plugin.PNG
Views: 250
Size:  41.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Running the installed feature</b></div><br />
So that our plug-in is installed and working properly!<br />
<br />
We installed the plug-in from a local site. You can also copy the artifacts to a remote server and install it via an <i>Update Site URL</i>.<br />
<br />
<b><font size="3">Uninstall the feature from Eclipse</font></b><br />
<br />
To uninstall the plug-in, select <b>Help </b>-&gt;<b> About Eclipse</b>. In the <i>About Eclipse </i>dialog, click <i>Installation Details</i>. In the <i>Eclipse Installation Details </i>dialog, select <i>MyFeature </i>from the list and click <b>Uninstall</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2931d1328501416-safebox-3-35-uninstall.png" border="0" alt="Name:  uninstall.PNG
Views: 239
Size:  15.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Uninstall the feature</b></div><br />
In the <i>Uninstall Details</i> dialog, click <b>Finish</b>. Eclipse is now uninstalling the software:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2932d1328501461-safebox-3-35-uninstall-progres.png" border="0" alt="Name:  uninstall progres.PNG
Views: 237
Size:  10.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The feature is being uninstalled</b></div><br />
Click <b>Apply Changes Now</b> when Eclipse asks, you will see the <i>My Menu</i> is immediately removed from the main menu. Check the <i>Installation Details </i>to see the <i>MyFeature </i>is no longer there. The plug-in is completely uninstalled.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/796-start-writing-plug-eclipse.html</guid>
		</item>
		<item>
			<title>Using WindowBuilder to design GUI in Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/795-using-windowbuilder-design-gui-eclipse.html</link>
			<pubDate>Mon, 06 Feb 2012 02:57:00 GMT</pubDate>
			<description>WindowBuilder is a great Eclipse plug-in that allows developers to visually design graphical user interface (GUI) for Java applications. It supports...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">WindowBuilder is a great Eclipse plug-in that allows developers to visually design graphical user interface (GUI) for Java applications. It supports developing both Swing and SWT applications. In addition, it also supports Google Web Toolkit (GWT) and XML Windowing Toolkit (XWT). This article introduces this plug-in to Java developers about installation and working within Eclipse IDE environment.<br />
<br />
<b><font size="3">Install WindowBuilder plug-in</font></b><br />
<br />
WindowBuilder is already integrated into Eclipse Indigo version (Eclipse IDE for Java Developers). If you are using older versions (Helios, Galileo, Ganymede, …) you need to install the plug-in through  the Eclipse’s <i>Install New Software</i> feature.<br />
<br />
Select <b>Help</b> -&gt; <b>Install New Software…</b> from Eclipse’s main menu. In the <i>Install</i> dialog, click <b>Add</b> button on the right of the dropdown list <i>Work with</i>. In the dialog <i>Add Repository</i>, you need to type the update URL of WindowBuilder into <i>Location</i> field. To know which update URL is for your current Eclipse version, go to <a href="http://www.eclipse.org/windowbuilder/download.php" target="_blank" rel="nofollow">http://www.eclipse.org/windowbuilder/download.php</a>. You will see the links for different versions of Eclipse:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2883d1328494544-agiletrack-1-1-1-update-sites.png" border="0" alt="Name:  Update Sites.PNG
Views: 5057
Size:  23.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Update links page for WindowBuilder</b></div><br />
Copy the link corresponding to your Eclipse version, and paste it into the <i>Location</i> field. Type a meaningful name for the <i>Name</i> field, such as <i>WindowBuilder</i>, and click <b>OK</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2884d1328494636-agiletrack-1-1-1-add-repository.png" border="0" alt="Name:  Add Repository.PNG
Views: 4851
Size:  8.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Install WindowBuilder via update URL</b></div><br />
Eclipse will load some information about the plug-in:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2885d1328494713-agiletrack-1-1-1-install-1.png" border="0" alt="Name:  Install 1.PNG
Views: 4873
Size:  30.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select features of WindowBuilder to install</b></div><br />
Click <b>Select All</b> to install all features of WindowBuilder, and click <b>Next</b>.<br />
<br />
In the screen <i>Install Details</i>, click <b>Next</b>.<br />
<br />
In the <i>Review Licenses</i> screen, select <i>I accept the terms of the license agreements</i>. Click <b>Finish</b>, Eclipse will download and install the plug-in:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2886d1328494885-agiletrack-1-1-1-installing-software.png" border="0" alt="Name:  installing software.PNG
Views: 4849
Size:  11.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Installation of WindowBuilder is in progress</b></div><br />
You may have to restart the IDE after the installation completed:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2887d1328494927-agiletrack-1-1-1-restart.png" border="0" alt="Name:  restart.PNG
Views: 4836
Size:  9.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: A restart is recommended after installation</b></div><br />
Click <b>Restart Now</b> to restart the IDE.<br />
<br />
<br />
<b><font size="3">The WindowBuilder’s views</font></b><br />
<br />
There is no separate perspective for WindowBuilder. Instead, Eclipse has three new views that support designing GUI:<br />
<br />
<ul><li style="">    <i>Design view</i>: the visual editor for designing windows, frames, dialogs, panels.</li><li style="">    <i>Palette view</i>: provides UI widgets, components and layouts available for designing.</li><li style="">    <i>Structure view</i>: displays the logical structure of the component being designed. This contains two panes:<br />
<ul><li style="">        <i>Components pane</i>: displays the hierarchical structure of the component being designed.</li><li style="">        <i>Properties pane</i>: displays the properties of the current selected object.</li></ul><br />
</li></ul><br />
<br />
<br />
<br />
The following screen shot illustrates the three views that come with WindowBuilder:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2888d1328495161-agiletrack-1-1-1-window-builder-views.png" border="0" alt="Name:  Window builder views.PNG
Views: 5173
Size:  109.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Views specific to WindowBuilder</b></div><br />
To show a view, select <b>Window</b> -&gt; <b>Show View</b> -&gt; <b>Other…</b>There is a new branch in the <i>Show View</i> dialog – WindowBuilder:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2889d1328495255-agiletrack-1-1-1-show-view.png" border="0" alt="Name:  show view.PNG
Views: 4833
Size:  10.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select a view of WindowBuilder</b></div><br />
The Design view is not shown here because it is available only when viewing the source code of a container by switching to design mode, as depicted in the following screenshot:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2890d1328495362-agiletrack-1-1-1-design-mode.png" border="0" alt="Name:  design mode.PNG
Views: 4841
Size:  18.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The Design mode</b></div><br />
To create a GUI container, select <b>File</b> -&gt; <b>New</b>. In the <i>New</i> dialog, expand the branch <i>WindowBuilder</i>, you will see about a dozen of containers and components that can be created and managed by WindowBuilder:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2891d1328495495-agiletrack-1-1-1-new-wizard.png" border="0" alt="Name:  new wizard.PNG
Views: 4842
Size:  27.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: WindowBuilder can work with various types of components</b></div><br />
All Swing’s widgets are available to create. For other toolkits like GWT, SWT and XWT you need to do additional installation. If you want to develop a SWT application, select <i>SWT User Interface</i> from the above dialog, and click <b>Next</b>. You will be asked to install the <i>SWT Toolkit</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2892d1328495595-agiletrack-1-1-1-install-swt-toolkit.png" border="0" alt="Name:  install swt toolkit.PNG
Views: 4840
Size:  21.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Install SWT Toolkit</b></div><br />
Click <b>Finish</b> to install SWT Toolkit. You have to restart the IDE after installation completed. SWT widgets are available to create in the <i>New</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2893d1328495698-agiletrack-1-1-1-swt-designer.png" border="0" alt="Name:  swt designer.PNG
Views: 4849
Size:  22.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The SWT Toolkit supports various components</b></div><br />
Follow the same steps to install <i>GWT Toolkit</i> and <i>XWT Toolkit</i>.<br />
<br />
<br />
<b><font size="3">The Palette View</font></b><br />
<br />
The Palette provides quick access to common widgets such as labels, buttons, text fields…This view is shown automatically when switching to design mode or manually by selecting <b>Window</b> -&gt; <b>Show View</b> from the main menu.<br />
<br />
You can drag and drop widgets from the Palette into the Design view. The widgets in the Palette are specific to the current toolkit. For example, the Swing’s widgets are different with the SWT’s ones.<br />
<br />
The following screenshot show different palette for Swing and SWT:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2894d1328496070-agiletrack-1-1-1-swing-palette.png" border="0" alt="Name:  swing palette.PNG
Views: 4890
Size:  60.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The difference between Swing palette and SWT palette</b></div><br />
The widgets are grouped by categories for easy access, such as Layouts, Controls, Menu… You can do various customizations via the context menu:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2895d1328496132-agiletrack-1-1-1-palette-context-menu.png" border="0" alt="Name:  palette context menu.PNG
Views: 4847
Size:  21.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The context menu of Palette view</b></div><br />
<b><font size="3">The Design View</font></b><br />
<br />
The <i>Design</i> view is the visual editor that allows to arrange, edit, move, re-size… widgets placed onto a container. The behavior of drag and drop widgets is different depending on the layout manager being used by the container.<br />
<br />
The following screenshot illustrates the behavior when drop a widget onto a container using GridBagLayout:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2896d1328496262-agiletrack-1-1-1-gridbag-layout.png" border="0" alt="Name:  gridbag layout.PNG
Views: 4798
Size:  10.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The behavior of a container using GridBagLayout</b></div><br />
And for a container that uses BorderLayout:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2897d1328496304-agiletrack-1-1-1-border-layout.png" border="0" alt="Name:  border layout.PNG
Views: 4800
Size:  7.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The behavior of a container using BorderLayout</b></div><br />
The visual editor comes with a handy toolbar that provides quick access for common operations such as preview the window, refresh the source code and the design page, undo/redo, change the look and feel…<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2898d1328496371-agiletrack-1-1-1-toolbar.png" border="0" alt="Name:  toolbar.PNG
Views: 4798
Size:  18.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The toolbar of Design page</b></div><br />
One great feature of WindowBuilder is, the design view and the source code are synchronized immediately when you make changes to either side. You can freely change the source code and the design page updates the changes immediately.<br />
<br />
When selecting a widget or component in the design view, the Components pane and Properties pane display the corresponding information.<br />
<br />
<b><font size="3">The Structure View</font></b><br />
<br />
The <i>Structure</i> view is activated when switching to design mode or selecting <b>Window</b> -&gt; <b>Show View</b> from the main menu. It is divided into two panes:<br />
<br />
<ul><li style="">    The <i>Components</i> pane: this represents the structure and relationship among components within a container in a hierarchical tree which allows quickly visualizing the structure and navigating among the components easily. In addition, you can perform various operations via the context menu:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2899d1328496718-agiletrack-1-1-1-structure-pane.png" border="0" alt="Name:  structure pane.PNG
Views: 4790
Size:  23.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The Components pane</b></div><br />
When selecting an object in the design view, the components tree is also updated for the selected current selected component. You also can drag and drop widgets from the Palette view into the components tree.</li><li style="">    The <i>Properties</i> pane: it is activated and refreshed each time a component is selected either in the design view or in the components tree. You can view and edit properties of the selected component via this pane, the changes are updated in the design view and components tree immediately.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2900d1328496793-agiletrack-1-1-1-properties-pane.png" border="0" alt="Name:  properties pane.PNG
Views: 4842
Size:  26.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The Properties pane</b></div></li></ul><br />
<br />
<br />
<b><font size="3">Configure WindowBuilder settings</font></b><br />
<br />
You can configure various settings for WindowBuilder by choosing <b>Window</b> -&gt; <b>Preferences</b> from the main menu, and select the branch <i>WindowBuilder</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2901d1328496873-agiletrack-1-1-1-windowbuilder-preferences.png" border="0" alt="Name:  windowbuilder preferences.PNG
Views: 4793
Size:  36.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure WindowBuilder settings</b></div><br />
<br />
<b><font size="3">References</font></b><br />
<br />
WindowBuilder is a powerful GUI design tool which comes as a plug-in for Eclipse IDE. Here are some great resources about the plug-in:<br />
<br />
<ul><li style="">    WindowBuilder’s home page: <a href="http://www.eclipse.org/windowbuilder/" target="_blank" rel="nofollow">http://www.eclipse.org/windowbuilder/</a>. <br />
This is the place to download separate installation or get update links.</li><li style="">    WindowBuilder’s documentation: <a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.wb.doc.user%2Fhtml%2Findex.html" target="_blank" rel="nofollow">http://help.eclipse.org/indigo/index...l%2Findex.html</a><br />
This is the original and great resource to learn using WindowBuilder.</li></ul></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/795-using-windowbuilder-design-gui-eclipse.html</guid>
		</item>
		<item>
			<title>Working with databases in Eclipse using QuantumDB</title>
			<link>http://www.java-forums.org/blogs/eclipse/793-working-databases-eclipse-using-quantumdb.html</link>
			<pubDate>Sun, 05 Feb 2012 11:32:50 GMT</pubDate>
			<description>Database is an important part of a software program. There are a number of tools/editors for popular RMDBS such as MySQL Query Browser, SQL Server...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Database is an important part of a software program. There are a number of tools/editors for popular RMDBS such as MySQL Query Browser, SQL Server Management Studio, TOAD… for database administrators and/or developers. For those who are working with Java and database using Eclipse IDE, a plug-in for database integrated in an IDE would be a necessary tool, and <i>QuantumDB</i> is such a plug-in. It is easy to setup and helps developers working with the most popular database systems smoothly.<br />
<br />
In summary, QuantumDB can work with various database systems: DB2, HSQLDB, MySQL, Oracle, Microsoft SQL Server … using standard JDBC drivers. It allows developer to review database structures like schemas, tables, views, sequences, constraints…; execute SQL statements against the database like inserts, updates, deletes…<br />
<br />
<b><font size="3">Install QuantumDB for Eclipse</font></b><br />
<br />
QuantumDB can be downloaded separately or installed as an Eclipse’s plug-in. The home page is <a href="http://quantum.sourceforge.net/" target="_blank" rel="nofollow">http://quantum.sourceforge.net/</a><br />
Select <b>Help</b> -&gt; <b>Install New Software</b> from Eclipse’s main menu. In the <i>Install</i> dialog, click <b>Add</b> button on the right of the drop-down list <i>Work with</i>, in the dialog <i>Add Repository</i>, type the following information:<br />
<br />
<ul><li style="">    <i>QuantumDB</i> for <i>Name</i> field.</li><li style="">    <i><a href="http://quantum.sourceforge.net/update-site" target="_blank" rel="nofollow">http://quantum.sourceforge.net/update-site</a></i> for <i>Location</i> field.</li></ul><br />
<br />
<br />
As in the following screen:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2860d1328437619-yourkit-java-profiler-7-0-build2026-install-add-repository.png" border="0" alt="Name:  install - add repository.PNG
Views: 1088
Size:  36.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Install QuantumDB via Eclipse's Software Update feature</b></div><br />
Click <b>OK</b>, Eclipse takes a while to load some information about the plug-in and display it in the list:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2861d1328437762-yourkit-java-profiler-7-0-build2026-install-2.png" border="0" alt="Name:  install 2.PNG
Views: 1066
Size:  32.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select features to be installed</b></div><br />
Here we see three items, click <b>Select All</b> to install all features of the plug-in. Then click <b>Next</b>. It may take a while for Eclipse to calculate the required disk space to install the plug-in. The following screen will be displayed afterward:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2862d1328437881-yourkit-java-profiler-7-0-build2026-install-3.png" border="0" alt="Name:  install 3.PNG
Views: 1060
Size:  29.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Review all items before installing</b></div><br />
Click <b>Next</b>. On the <i>Review Licenses</i> screen, select <i>I accept the terms of the license agreements</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2863d1328437969-yourkit-java-profiler-7-0-build2026-install-review-license.png" border="0" alt="Name:  install - review license.PNG
Views: 1063
Size:  29.8 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Accept the terms and license agreement</b></div><br />
Then click <b>Finish</b>. The download and installation may take a few minutes to complete, depending on your network speed:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2864d1328438633-yourkit-java-profiler-7-0-build2026-installing-software.png" border="0" alt="Name:  installing software.PNG
Views: 1058
Size:  11.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Installation progress</b></div><br />
During the installation, Eclipse will pop up a warning:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2865d1328438671-yourkit-java-profiler-7-0-build2026-security-warning.png" border="0" alt="Name:  security warning.PNG
Views: 1054
Size:  9.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Security warning</b></div><br />
Click <b>OK</b> to continue. After the installation completed, Eclipse will ask to restart the IDE:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2866d1328438729-yourkit-java-profiler-7-0-build2026-software-update.png" border="0" alt="Name:  software update.PNG
Views: 1055
Size:  9.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: A restart required after installation</b></div><br />
Click <b>Restart Now</b> to restart the IDE.<br />
<br />
<br />
<b><font size="3">Working in QuantumDB Perspective</font></b><br />
<br />
The plug-in provides a perspective – the <i>Quantum DB</i> perspective which can be opened by selecting <b>Window</b> -&gt; <b>Open Perspective</b> -&gt; <b>Other…</b> Select <i>Quantum DB</i> from the <i>Open Perspective</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2867d1328438979-yourkit-java-profiler-7-0-build2026-open-perspective.png" border="0" alt="Name:  open perspective.PNG
Views: 1057
Size:  17.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: A new perspective available for QuantumDB in Eclipse</b></div><br />
The Quantum DB perspective displays the following views by default:<br />
<ul><li style="">    <i>Database Bookmarks</i>: manages database connections as bookmarks.</li><li style="">    <i>Quantum SQL Queries View</i>: edit and execute SQL queries.</li><li style="">    <i>Quantum Table View</i>: displays result sets made by the queries.</li><li style="">    <i>Quantum SQL Log</i>: shows SQL queries history and other logging information.</li></ul><br />
<br />
The following screenshot shows the Quantum DB perspective in Eclipse:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2868d1328439095-yourkit-java-profiler-7-0-build2026-quantum-db-perspective.png" border="0" alt="Name:  Quantum DB perspective.PNG
Views: 1080
Size:  61.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The QuantumDB perspective in Eclipse IDE</b></div><br />
<br />
<b><font size="3">Connect to a database</font></b><br />
<br />
Making connection to a database is the first and important task. Quantum DB makes this easy by the <i>Database Bookmarks</i> view, as you can define the connections once and re-use them later, just like bookmarks. Another important thing is, QuantumDB uses standard JDBC drivers to work with database, so you must have JAR files for those drivers ready on your computer, such as <span style="font-family: Courier New"><font size="2">mysql-connector-java.jar</font></span> for MySQL, or <span style="font-family: Courier New"><font size="2">ojdbc.jar</font></span> for Oracle. In this article we will make connection to a MySQL database.<br />
<br />
In the <i>Database Bookmarks</i> view, click on <i>New Bookmark</i> icon:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2869d1328439371-yourkit-java-profiler-7-0-build2026-new-bookmark.png" border="0" alt="Name:  new bookmark.PNG
Views: 1058
Size:  4.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Add new database bookmark</b></div><br />
In the <i>New Bookmark</i> dialog, click <b>Add Driver…</b> The <i>New JDBC Driver</i> dialog appears, do the followings:<br />
<br />
<ul><li style="">    Click <b>Add External Jar…</b> to select the JDBC driver’s JAR file, such as <span style="font-family: Courier New"><font size="2">mysql-connector-java-5.1.7-bin.jar</font></span> for MySQL database.</li><li style="">    Select <i>MySQL</i> in the dropdown <i>Type</i>.</li><li style="">    Click <b>Browse</b> to select driver’s class name, <span style="font-family: Courier New"><font size="2">com.mysql.jdbc.Driver</font></span>, for MySQL.</li></ul><br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2870d1328439556-yourkit-java-profiler-7-0-build2026-select-driver.png" border="0" alt="Name:  select a driver.PNG
Views: 1048
Size:  8.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select a driver class name</b></div><br />
The <i>New JDBC Driver</i> dialog should look like the following screenshot:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2871d1328439689-yourkit-java-profiler-7-0-build2026-new-jdbc-driver.png" border="0" alt="Name:  new JDBC Driver.PNG
Views: 1069
Size:  14.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Setup a JDBC driver</b></div><br />
Click <b>Finish</b>. The driver name <span style="font-family: Courier New"><font size="2">com.mysql.jdbc.Driver</font></span> is added to the <i>New Bookmark</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2872d1328439784-yourkit-java-profiler-7-0-build2026-new-bookmark-2.png" border="0" alt="Name:  new bookmark 2.PNG
Views: 1055
Size:  24.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: A new driver is added</b></div><br />
Select the <span style="font-family: Courier New"><font size="2">com.mysql.jdbc.Driver</font></span> name, click <b>Next</b>. In the next screen, you need to provide detail information to connect to the database, such as userid, password, host name, port, and database name:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2873d1328439872-yourkit-java-profiler-7-0-build2026-connection-details.png" border="0" alt="Name:  connection details.PNG
Views: 1068
Size:  24.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Specify database connection details</b></div><br />
After typing the required information, click <b>Next</b>. In the next screen, you will provide a name for the bookmark:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2874d1328440048-yourkit-java-profiler-7-0-build2026-bookmark-name.png" border="0" alt="Name:  bookmark name.PNG
Views: 1061
Size:  21.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Name for the database bookmark</b></div><br />
Click <b>Next</b>. In the last screen, you are asked to select which schemas should be displayed, select <i>Show all schemas</i>:<br />
<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2875d1328440130-yourkit-java-profiler-7-0-build2026-schemas.png" border="0" alt="Name:  schemas.PNG
Views: 1047
Size:  22.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select which schema should be displayed</b></div><br />
Click <b>Finish</b>. The new bookmark, <i>MySQL</i>, is added to the <i>Database Bookmarks</i> view. Right click (or double left click) on the bookmark to connect to the database:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2876d1328440207-yourkit-java-profiler-7-0-build2026-connect.png" border="0" alt="Name:  connect.PNG
Views: 1053
Size:  7.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Connect to the database</b></div><br />
The plug-in connects to the database and displays the structures in tree format, like the following screenshot:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2877d1328440277-yourkit-java-profiler-7-0-build2026-tree-structure.png" border="0" alt="Name:  tree structure.PNG
Views: 1062
Size:  16.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The database tree structure</b></div><br />
From this well-organized tree, you can perform various operations against database objects such as tables, views, procedures… by the context menu displayed when clicking on the object name. The output will be displayed as a tab in the <i>Quantum Table View</i>, and the logging information will be displayed in the <i>Quantum SQL Log</i> view.<br />
<br />
<br />
<b><font size="3">Working with database tables</font></b><br />
<br />
Most of the time you will be working with database tables, so the following list describes the most common and useful operations against tables:<br />
<br />
<ul><li style="">    Query all data of a table: Right click on the table name, select <b>View Table</b> (or left double click on the table name), the result set is displayed in the <i>Quantum Table View</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2878d1328440596-yourkit-java-profiler-7-0-build2026-quantum-table-view.png" border="0" alt="Name:  quantum table view.PNG
Views: 1047
Size:  13.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Query all table data</b></div></li><li style="">    View detailed structure of a table: Right click on the table name, select <b>View Table Details</b>. The structure is displayed like this:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2879d1328440677-yourkit-java-profiler-7-0-build2026-table-details.png" border="0" alt="Name:  table details.PNG
Views: 1043
Size:  10.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: View table structure in details</b></div></li><li style="">    Quick delete all rows in a table: select <b>SQL Statements</b> -&gt; <b>Delete All Rows</b> from the table’s context menu.</li><li style="">    Quick drop a table: select <b>SQL Statements</b> -&gt; <b>Drop Table/View/Sequence…</b> from the table’s context menu.</li><li style="">    Export table structure: select <b>Copy</b> from the context menu, the XML structure data will be copied into clipboard. This feature is useful if you are working with <i>DbUnit</i> testing framework.</li><li style="">    Export table data to XML catalog: Select <b>Export</b> from the context menu, in the <i>Export</i> dialog, select <b>XML</b> -&gt; <b>XML Catalog</b>. This feature is useful if you are working with <i>DbUnit</i> testing framework.</li></ul><br />
<br />
<br />
<b><font size="3">Working with Quantum SQL Queries View</font></b><br />
<br />
This view allows developers to type in queries in SQL language and execute them against the database. There are two main ways to execute queries:<br />
<br />
<ul><li style="">    Execute all statements in the editor: Do not select any statement, click on the <b>Execute</b> button</li><li style="">    Execute a specific statement: Select the entire statement, then click <b>Execute</b> button.</li></ul><br />
<br />
You can also execute the statements from the context menu displayed when right clicking either on the selected statement or in the editor.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2880d1328441077-yourkit-java-profiler-7-0-build2026-execute-statement.png" border="0" alt="Name:  execute statement.PNG
Views: 1068
Size:  19.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The SQL Queries view</b></div><br />
<br />
<br />
<b><font size="3">Working with Quantum Table View</font></b><br />
<br />
This view is not only to display data. It also allows developers to do some common tasks for a result set: Insert, Update, Delete, Export… All these commands can be found from the context menu:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2881d1328441184-yourkit-java-profiler-7-0-build2026-working-result-set.png" border="0" alt="Name:  working with result set.PNG
Views: 1070
Size:  15.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Context commands for a result set</b></div><br />
However, the plug-in does not allow you to alter table structure, just view.<br />
<br />
<br />
<b><font size="3">Other views</font></b><br />
<br />
The plug-in comes with some other views, to see the complete list, select <b>Window</b> -&gt; <b>Show View</b> -&gt; <b>Other…</b> and expand the <i>QuantumDB</i> branch:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/java-software/2882d1328441319-yourkit-java-profiler-7-0-build2026-quantum-views.png" border="0" alt="Name:  quantum views.PNG
Views: 1053
Size:  13.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: All views of QuantumDB perspective</b></div><br />
<br />
<b><font size="3">Disconnect from database</font></b><br />
<br />
After finish working with the database, right click on the database bookmark name, select <b>Disconnect</b>.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/793-working-databases-eclipse-using-quantumdb.html</guid>
		</item>
		<item>
			<title>Using custom Ant build script for Eclipse projects</title>
			<link>http://www.java-forums.org/blogs/eclipse/792-using-custom-ant-build-script-eclipse-projects.html</link>
			<pubDate>Sun, 05 Feb 2012 04:25:13 GMT</pubDate>
			<description>Ant is XML-based script for building Java applications. Ant is popularly used in Java development because of its powerful and flexibility. It makes...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Ant is XML-based script for building Java applications. Ant is popularly used in Java development because of its powerful and flexibility. It makes developer’s life easier by automatically processing repetitive tasks that happen before, during and after building of Java applications. Eclipse is a great IDE which supports Ant by integrating Ant’s libraries as its plug-in.<br />
<br />
Generally, you may not deal with any Ant script during development of a Java project in Eclipse. However if your project has a quite complex process that involves in building or testing of a application and the Eclipse IDE itself cannot help, it’s time to consider to use custom Ant build script for the project. For example, suppose you have to package your application as a JAR file, include some documents and put all together in a zip file, then finally upload the zip archive to a FTP server. This process has to be made after every build of the application. It would be boring and time-consuming if you do all this repetitive tasks again and over again, thus using a custom Ant script to automate the tasks in this scenario will make things much easier.<br />
<br />
In this article you will learn how to configure a custom Ant build script in Eclipse to automate the repetitive tasks of the above scenario.<br />
The Eclipse IDE has built-in support for Ant so that you don’t have to download Ant distribution to run Ant script.<br />
<br />
<b><font size="3">Project’s scenario</font></b><br />
<br />
Suppose you already have written a Java project in Eclipse. After the project is built (by Eclipse’s auto-build feature), you want to do the following tasks:<br />
<br />
<ul><li style="">    Package the compiled classes as a JAR file.</li><li style="">    Create a distribution directory.</li><li style="">    Copy two support documents to the distribution directory.</li><li style="">    Compress the distribution directory into a single zip archive.</li><li style="">    Upload the Zip archive to a FTP server.</li></ul><br />
<br />
<br />
<b><font size="3">Creating Ant build file</font></b><br />
<br />
Right click on the project name in the <i>Project Explorer</i> view, select <b>New</b> -&gt; <b>File</b>. In the <i>New</i> dialog, type <span style="font-family: Courier New"><font size="2">antbuild.xml</font></span> as <i>File name</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2846d1328413309-how-implement-secure-connection-https-client-side-new-xml.png" border="0" alt="Name:  new xml.PNG
Views: 614
Size:  15.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create new Ant build file</b></div><br />
Click <b>Finish</b>, and then add some code for the <span style="font-family: Courier New"><font size="2">antbuild.xml</font></span> file as following:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">XML Code: Content of the antbuild.xml file</div>

	<pre class="brush: xml">&lt;project name=&quot;Custom Ant Build&quot;&gt;
   
    &lt;target name=&quot;createJar&quot;&gt;
        &lt;echo message=&quot;Creating JAR file...&quot; /&gt;
    &lt;/target&gt;

    &lt;target name=&quot;makeDirectory&quot;&gt;
        &lt;echo message=&quot;Making dist directory...&quot; /&gt;
    &lt;/target&gt;
   
    &lt;target name=&quot;copyDocument&quot;&gt;
        &lt;echo message=&quot;Copying documents...&quot; /&gt;
    &lt;/target&gt;   

    &lt;target name=&quot;zipDist&quot;&gt;
        &lt;echo message=&quot;Compressing data...&quot; /&gt;
    &lt;/target&gt;

    &lt;target name=&quot;upload&quot;&gt;
        &lt;echo message=&quot;Uploading to FTP server...&quot; /&gt;
    &lt;/target&gt;
   
    &lt;target name=&quot;default&quot; depends=&quot;createJar, makeDirectory, copyDocument, zipDist, upload&quot; /&gt;
   
&lt;/project&gt;</pre>
	<script type="text/javascript">mh_sh_highlight_all('xml');</script>

</div>
 In our custom build, we created 6 targets. The first 5 targets are equivalent to the 5 tasks in the project’s scenario. The last target will be the main one that calls the others in the order as specified by the <span style="font-family: Courier New"><font size="2">depends</font></span> attribute of the target <span style="font-family: Courier New"><font size="2">default</font></span>. Each target simply prints out a message corresponding to its purpose, by using the <span style="font-family: Courier New"><font size="2">&lt;echo /&gt;</font></span> tag. We don’t write real Ant tasks for the targets because this article’s purpose is to demonstrate how a custom build can be used with Eclipse, and the implementation of details is up to you. Ant provides various tasks that help you to complete the described scenario, here are some suggestions:<br />
<br />
<ul><li style="">    Task <span style="font-family: Courier New"><font size="2">jar</font></span>: creates a JAR file</li><li style="">    Task <span style="font-family: Courier New"><font size="2">mkdir</font></span>: creates a directory</li><li style="">    Task <span style="font-family: Courier New"><font size="2">copyfile</font></span>: copies files.</li><li style="">    Task <span style="font-family: Courier New"><font size="2">zip</font></span>: creates a zip file.</li><li style="">    Task <span style="font-family: Courier New"><font size="2">FTP</font></span>: performs various operations with a FTP server.</li></ul><br />
<br />
<br />
<b><font size="3">Adding custom Ant build to the project</font></b><br />
<br />
Select <b>Project</b> -&gt; <b>Properties</b> from the main menu. In the project properties dialog, select <i>Builders</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2847d1328413820-how-implement-secure-connection-https-client-side-select-builder.png" border="0" alt="Name:  select builder.PNG
Views: 538
Size:  22.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure Builders for the project</b></div><br />
You can see the <i>Java Builder</i> in the list on the right, this is the default build which Eclipse uses to build the project. We cannot modify this default build. To add our custom build script, click <b>New</b>. In the dialog <i>Choose configuration type</i>, select <i>Ant Builder</i>, click <b>OK</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2848d1328413990-how-implement-secure-connection-https-client-side-choose-configuration-type.png" border="0" alt="Name:  choose configuration type.PNG
Views: 529
Size:  8.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create Ant Builder type</b></div><br />
The dialog <i>Properties for New_Builder</i> appears to let us configure our custom build.<br />
<br />
<ul><li style="">    Type Ant_Builder into the <i>Name</i> field.</li></ul><br />
<br />
On the <i>Main</i> tab:<br />
<br />
<ul><li style="">    Click <b>Browse Workspace…</b> under <i>Buildfile</i> section to select the Ant build script.</li><li style="">    Under the <i>Base Directory</i> section, click <b>Browse Workspace</b> to select the directory in which our Ant script will consider as its home directory.</li></ul><br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2850d1328414404-how-implement-secure-connection-https-client-side-main-tab.png" border="0" alt="Name:  main tab.PNG
Views: 533
Size:  36.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure Ant builder</b></div><br />
Select <i>Targets</i> tab. This tab allows us to specify when and what will be executed. There are four point of time (event) that we can select to run our custom build script:<br />
<br />
<ul><li style="">    <i>After a “Clean”</i>: run the script after a clean project action is performed.</li><li style="">    <i>Manual Build</i>: run the script before or after a manual build action is performed. We can specify before or after later.</li><li style="">    <i>Auto Build</i>: run the script before or after an auto build action is performed.</li><li style="">    <i>During a “Clean”</i>: run the script during a clean action is performed.</li></ul><br />
<br />
<br />
On the right of each event, there is a button <i>Set Targets</i>. This button allows us to specify the target in our Ant script will be executed. We select the event <i>Manual Build</i>, click <b>Set Targets</b> button, the target <i>default</i> is automatically selected:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2851d1328414571-how-implement-secure-connection-https-client-side-set-targets.png" border="0" alt="Name:  set targets.PNG
Views: 531
Size:  12.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select target to run</b></div><br />
Click <b>OK</b> to close the <i>Set Targets</i> dialog and return to the <i>Properties for New_Builder</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2849d1328414235-how-implement-secure-connection-https-client-side-properties-new-builder.png" border="0" alt="Name:  properties for new builder.PNG
Views: 544
Size:  31.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure targets for build event</b></div><br />
Click <b>OK</b> to close this dialog and return to the <i>Project properties</i> dialog:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2852d1328414865-how-implement-secure-connection-https-client-side-project-properties-2.png" border="0" alt="Name:  project properties 2.PNG
Views: 535
Size:  23.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: New Ant builder is added</b></div><br />
Our custom build, <i>Ant_Builder</i> is added to the <i>Builders</i> list, after the built-in <i>Java Builder</i>. The order of builders does matter here: Eclipse will process the builders in that order. The <i>Ant_Builder</i> is after <i>Java Builder</i>, so Eclipse will execute <i>Java Builder</i> first, then to <i>Ant_Builder</i>. If you want to change the order, select the builder name, click <b>Up</b> or <b>Down</b> button. You can add as many custom builders as you want, and make sure everything are in order.<br />
<br />
<br />
<b><font size="3">Testing the custom build in Eclipse</font></b><br />
<br />
Now, let’s test how the custom build gets running. Click <b>OK</b> to close the project properties dialog. Because we have set to run our custom build for the event <i>Manual Build</i>, we can test by manually build the project by selecting <b>Project</b> -&gt; <b>Build All</b> from the main menu:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2853d1328415296-how-implement-secure-connection-https-client-side-menu-build-all.png" border="0" alt="Name:  menu build all.PNG
Views: 522
Size:  10.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Manually build all</b></div><br />
After the project is built, our custom ant build is executed and we will see some outputs in the <i>Console</i> view, like the following screen:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2854d1328415399-how-implement-secure-connection-https-client-side-custom-build-run.png" border="0" alt="Name:  custom build run.PNG
Views: 567
Size:  27.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Console output for build</b></div><br />
That’s what we’d expect! We have successfully configured a custom build for the project.<br />
<br />
<br />
<b><font size="3">Writing build script with Ant Editor</font></b><br />
<br />
In order to write Ant script efficiently, the XML file should be opened by Ant editor which is not opened by default for XML file. In the <i>Project Explorer</i> view, right click on the Ant build file, select <b>Open With</b> -&gt; <b>Ant Editor</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2855d1328415583-how-implement-secure-connection-https-client-side-open-ant-editor.png" border="0" alt="Name:  open with ant editor.PNG
Views: 519
Size:  17.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Open the XML with Ant Editor</b></div><br />
Eclipse will provide code completion for writing Ant script:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2856d1328415634-how-implement-secure-connection-https-client-side-ant-editor.png" border="0" alt="Name:  ant editor.PNG
Views: 530
Size:  36.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The Ant script editor</b></div><br />
<br />
<b><font size="3">Configure Ant settings</font></b><br />
<br />
You can configure various Ant’s runtime and editor settings via the <i>Preferences</i> dialog by selecting <b>Window</b> -&gt; <b>Preferences</b> from the main menu. Then select <i>Ant</i> branch:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/networking/2857d1328415784-how-implement-secure-connection-https-client-side-ant-preferences.png" border="0" alt="Name:  Ant preferences.PNG
Views: 527
Size:  37.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure Ant settings</b></div></blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/792-using-custom-ant-build-script-eclipse-projects.html</guid>
		</item>
		<item>
			<title>Working with Java Servlets in Eclipse</title>
			<link>http://www.java-forums.org/blogs/eclipse/791-working-java-servlets-eclipse.html</link>
			<pubDate>Sat, 04 Feb 2012 16:56:11 GMT</pubDate>
			<description>Servlet is a Java program that runs on a web server to handle requests and returns response to clients. It is widely used for Java enterprise...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore"><i>Servlet</i> is a Java program that runs on a web server to handle requests and returns response to clients. It is widely used for Java enterprise development, and <i>Eclipse</i> is one of the best IDE for Java development. So this article will walk you through a Java project using Eclipse IDE to create a web application that plays around with a <i>Java servlet</i>.<br />
<br />
<b><font size="3">Set up Eclipse development environment</font></b><br />
The following software programs are required to be installed on your computer:<br />
<ul><li style=""><i>Java JDK 7.0</i>: This is the latest Java version at the time of writing this article. Download the JDK at: <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank" rel="nofollow">http://www.oracle.com/technetwork/ja...ads/index.html</a><br /></li><li style=""><i>Eclipse IDE for Java EE Developers</i> (Eclipse Indigo, version 3.7). Download the latest version of Eclipse at:<br />
<br />
<a href="http://www.eclipse.org/downloads/" target="_blank" rel="nofollow">http://www.eclipse.org/downloads/</a><br />
<br />
If you have <i>Eclipse for Java Developers</i> already installed, you have to install <i>Web Tools Platform (WTP)</i> in order to work with Java EE project. To install the WTP plug-in, select <b>Help</b> -&gt; <b>Install New Software…</b> from Eclipse’s main menu. In the <i>Install</i> dialog, select “<i>Indigo - <a href="http://download.eclipse.org/releases/indigo" target="_blank" rel="nofollow">http://download.eclipse.org/releases/indigo</a></i>” from the drop down <i>Work with</i>, and check “<i>Web, XML, Java EE and OSGi Enterprise Development</i>” from the list, then click <b>Next</b>. And you have to restart Eclipse after the installation completed.<br /></li><li style=""><i>Tomcat</i> server: we will work with the latest version of Tomcat, 7.0. Download Tomcat 7.0 distribution at: <a href="http://tomcat.apache.org/download-70.cgi" target="_blank" rel="nofollow">http://tomcat.apache.org/download-70.cgi</a></li></ul><br />
<br />
<b><font size="3">The project</font></b><br />
<br />
We are going to build a simple but interesting web application. There is a web page that allows user to type a text and hit Submit button, the server will return an image with the text embedded at the center.<br />
<br />
<b><font size="3">A quick introduction to Servlet</font></b><br />
<br />
Here are some briefs about Java servlet you need to know:<br />
<br />
<ul><li style="">    A servlet is a Java program that runs on web server supports Java EE, such as Tomcat.</li><li style="">    A servlet is just a Java class that extends the <span style="font-family: Courier New"><font size="2">GenericServlet</font></span> class or the <span style="font-family: Courier New"><font size="2">HttpServlet</font></span> class.</li><li style="">    To handle client’s requests, the servlet class should override one of the following methods: <span style="font-family: Courier New"><font size="2">doGet(), doPost(), doPut(), service()</font></span>…However the <span style="font-family: Courier New"><font size="2">doGet()</font></span> and <span style="font-family: Courier New"><font size="2">doPost()</font></span> are the two methods which are commonly used.</li><li style="">    The <span style="font-family: Courier New"><font size="2">HttpServletRequest</font></span> interface defines actions to work with client’s request.</li><li style="">    To read data sent from the client (such as value of parameters or form fields), invoke method <span style="font-family: Courier New"><font size="2">getParameter(String paramName)</font></span>  from an instance of the <span style="font-family: Courier New"><font size="2">HttpServletRequest</font></span> interface.</li><li style="">    The <span style="font-family: Courier New"><font size="2">HttpServletResponse</font></span> interface defines actions to work with response to client.</li><li style="">    To send output to the client, invoke methods on the <span style="font-family: Courier New"><font size="2">ServletOutputStream</font></span> object which is returned from <span style="font-family: Courier New"><font size="2">HttpServletResponse.getOutputStream()</font></span> method.</li><li style="">    A servlet must be registered in the web deployment descriptor file (web.xml) in order to serve client’s requests.</li><li style="">    A servlet can handle particular URL patterns through mapping in the web.xml file.</li><li style="">    A serlvet has the following life cycle methods: <span style="font-family: Courier New"><font size="2">init(), service()</font></span> and <span style="font-family: Courier New"><font size="2">destroy()</font></span>.</li><li style="">    There is only one instance of a servlet created per web application.</li><li style="">    Each client’s request is served by a separate thread.</li></ul><br />
<br />
<b><font size="3">Creating the project in Eclipse</font></b><br />
<br />
Select <b>File</b> -&gt; <b>New</b> -&gt; <b>New Project…</b> from Eclipse’s main menu. In the <i>New Project</i> dialog, select <i>Dynamic Web Project</i> from the <i>Web</i> node:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2823d1328370034-compatibility-dual-core-procesors-new-project-1.png" border="0" alt="Name:  new project 1.PNG
Views: 527
Size:  19.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: New project in Eclipse </b></div><br />
Click <b>Next</b>, in the <i>New Dynamic Web Project</i> screen, type <i>ImageServlet</i> as <i>Project name</i>, leave others as default:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2824d1328370327-compatibility-dual-core-procesors-new-project-2.png" border="0" alt="Name:  new project 2.PNG
Views: 511
Size:  31.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create new Dynamic Web project</b></div><br />
Click <b>Finish</b>, the project is created with the following structure:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2825d1328370432-compatibility-dual-core-procesors-project-structure-1.png" border="0" alt="Name:  project structure 1.PNG
Views: 513
Size:  11.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The project structure </b></div><br />
<br />
<b><font size="3">Configure server runtime</font></b><br />
<br />
Next, we need to add <i>Tomcat 7.0</i> as the targeted runtime for our web application. The server runtime includes libraries and configuration that let us work with Java servlets. Select <b>Project</b> -&gt; <b>Properties</b> from the main menu. In the dialog <i>Project properties for ImageServlet</i>, select the node <i>Targeted Runtimes</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2826d1328370610-compatibility-dual-core-procesors-targeted-runtime-1.png" border="0" alt="Name:  Targeted Runtime 1.PNG
Views: 521
Size:  28.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Project Properties </b></div><br />
Click <b>New</b>, the <i>New Server Runtime Environment</i> dialog appears. If Tomcat 7.0 is installed on your computer successfully, you will see it under the <i>Apache</i> node:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2827d1328370845-compatibility-dual-core-procesors-new-server-runtime-environment.png" border="0" alt="Name:  New Server Runtime Environment.PNG
Views: 511
Size:  23.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select Server Runtime </b></div><br />
Select <i>Apache Tomcat v7.0</i> from the list, and click <b>Next</b>. On the next screen, you need to specify the directory of your Tomcat’s installation:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2828d1328370974-compatibility-dual-core-procesors-new-server-runtime-environment-2.png" border="0" alt="Name:  New Server Runtime Environment 2.PNG
Views: 511
Size:  17.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure Tomcat server</b></div><br />
Click <b>Browse</b> to select the directory of Tomcat’s installation which is usually under: <i>C:\Program Files\Apache Software Foundation\Tomcat 7.0</i> if you are using Windows.<br />
<br />
Click <b>Finish</b> to close the <i>New Server Runtime Environment</i> dialog. You will see <i>Apache Tomcat v7.0</i> is added to the screen <i>Properties for ImageServlet</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2829d1328371092-compatibility-dual-core-procesors-new-server-runtime-environment-3.png" border="0" alt="Name:  New Server Runtime Environment 3.PNG
Views: 515
Size:  29.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Tomcat is configured as a Target runtime</b></div><br />
Check the <i>Apache Tomcat v7.0</i>, and click <b>OK</b>. The server runtime is now configured.<br />
<br />
From the main menu, select <b>Window</b> -&gt; <b>Show View</b> -&gt; <b>Servers</b> to open the <i>Servers</i> view that allows us to work with the server and deploy the web application. Right click in the <i>Servers</i> view’s area, select <b>New</b> -&gt; <b>Server</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2830d1328371521-compatibility-dual-core-procesors-new-server.png" border="0" alt="Name:  New Server.PNG
Views: 504
Size:  9.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a new server </b></div><br />
The <i>New Server</i> dialog appears, select <i>Tomcat v7.0 Server</i> under <i>Apache</i> node, then click <b>Finish</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2831d1328371629-compatibility-dual-core-procesors-new-server-2.png" border="0" alt="Name:  New Server 2.PNG
Views: 509
Size:  25.6 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Define a new server</b></div><br />
The server is now added to the <i>Servers</i> view:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2832d1328371681-compatibility-dual-core-procesors-new-server-added.png" border="0" alt="Name:  New Server added.PNG
Views: 513
Size:  6.9 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The Servers view</b></div><br />
To test the server, right click on its name in the <i>Servers</i> view, select <b>Start</b>. You should see some logging information in the <i>Console</i> view indicates that the server is up and running.<br />
<br />
<br />
<b><font size="3">Creating the Servlet</font></b><br />
<br />
First, create a new package under which we will put our servlet class. In the <i>Project Explorer</i> view, right click on the <span style="font-family: Courier New"><font size="2">src</font></span> directory, select <b>New</b> -&gt; <b>Package</b>. In the <i>New Java Package</i> dialog, type <span style="font-family: Courier New"><font size="2">com.servlet.tutorial</font></span> into the <i>Name</i> field, and click <b>Finish</b>.<br />
<br />
Now, expand the node <i>Deployment Descriptor:…</i>, right click on the Servlets, select <b>New</b> -&gt; <b>Servlet</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2833d1328372027-compatibility-dual-core-procesors-create-servlet-1.png" border="0" alt="Name:  Create Servlet 1.PNG
Views: 513
Size:  25.0 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a new servlet</b></div><br />
In the <i>Create Servlet</i> dialog, type <span style="font-family: Courier New"><font size="2">com.servlet.tutorial</font></span> into the field <i>Java package</i>, and type <span style="font-family: Courier New"><font size="2">ImageServlet</font></span> into the field <i>Class name</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2834d1328372149-compatibility-dual-core-procesors-create-servlet-2.png" border="0" alt="Name:  Create Servlet 2.PNG
Views: 509
Size:  21.2 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Configure servlet information</b></div><br />
Click <b>Next</b>. In the next screen, we can type description for the servlet in the <i>Description</i> field. The <i>Initialization parameters</i> section allows us to define init parameters for the servlet, however we don’t need this; the section <i>URL mappings</i> show all URL patterns that are mapped to the servlet. Eclipse automatically created the default one: <span style="font-family: Courier New"><font size="2">/ImageServlet</font></span><br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2835d1328372689-compatibility-dual-core-procesors-create-servlet-3.png" border="0" alt="Name:  Create Servlet 3.PNG
Views: 520
Size:  19.3 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: URL mapping for servlet</b></div><br />
Click <b>Next</b>. In the next screen we can specify which methods from the <span style="font-family: Courier New"><font size="2">HttpServlet</font></span> class to be overridden. We implement only the <span style="font-family: Courier New"><font size="2">doPost()</font></span> method, so check the <i>Inherited abstract methods</i> and <i>doPost</i>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2836d1328372995-compatibility-dual-core-procesors-create-servlet-4.png" border="0" alt="Name:  Create Servlet 4.PNG
Views: 505
Size:  21.7 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Select stub methods  to implement</b></div><br />
Click <b>Finish</b>. Eclipse creates the servlet class looks like the following:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2838d1328373061-compatibility-dual-core-procesors-editor-servlet-class.png" border="0" alt="Name:  Editor Servlet class.PNG
Views: 543
Size:  25.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: The generated Servlet code</b></div><br />
As you can notice, the annotation <span style="font-family: Courier New"><font size="2">@WebServlet(&quot;/ImageServlet&quot;)</font></span> is added to the class <span style="font-family: Courier New"><font size="2">ImageServlet</font></span>:<br />
<br />
<ul><li style="">    <span style="font-family: Courier New"><font size="2">@WebServlet</font></span> is the annotation name.</li><li style="">    <span style="font-family: Courier New"><font size="2">/ImageServlet</font></span> is the URL pattern which is mapped to this servlet.</li></ul><br />
<br />
<br />
<b><font size="3">Creating the JSP page</font></b><br />
<br />
In order to call the servlet, we write a simple JSP page that contains only one text field and a button. Right click on the <i>WebContent</i> node, select <b>New</b> -&gt; <b>JSP File</b>. <br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2839d1328373356-compatibility-dual-core-procesors-create-jsp-file.png" border="0" alt="Name:  Create JSP file.PNG
Views: 530
Size:  21.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Create a new JSP file</b></div><br />
In the <i>New JSP File</i> dialog, type <span style="font-family: Courier New"><font size="2">index.jsp</font></span> as the <i>File name</i>, click <b>Finish</b>. Add the following code to the <span style="font-family: Courier New"><font size="2">index.jsp</font></span> page:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;
   pageEncoding=&quot;ISO-8859-1&quot;%&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&gt;
&lt;title&gt;Add Text to Image&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;center&gt;
        &lt;form action=&quot;ImageServlet&quot; method=&quot;post&quot;&gt;
            Text &lt;input type=&quot;text&quot; name=&quot;imageText&quot; size=&quot;30&quot; /&gt; &lt;br&gt;
            &lt;br&gt; &lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;
        &lt;/form&gt;
    &lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 <br />
There is one thing should be noticed here: We specify <span style="font-family: Courier New"><font size="2">ImageServlet</font></span> as the form’s action. This name should map with the servlet mapping specified by the annotation <span style="font-family: Courier New"><font size="2">@WebServlet(&quot;/ImageServlet&quot;)</font></span>. Doing so our servlet will be invoked after the form is submitted.<br />
<br />
<b><font size="3">Coding the Servlet</font></b><br />
<br />
The servlet reads a text send from the user (via the form in the <span style="font-family: Courier New"><font size="2">index.jsp</font></span> page), embed the text into a specified image then return the image back to the user. The code is implemented in the <span style="font-family: Courier New"><font size="2">doPost()</font></span> method as follow:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
       
        // get the text from user
        String text = request.getParameter(&quot;imageText&quot;);
       
        // place is image under WebContent
        String imageName = &quot;MyCar.jpg&quot;;
       
        // get absolute path of the image
        String imagePath = getServletContext().getRealPath(imageName);
       
        // load the image

       BufferedImage image = ImageIO.read(new File(imagePath));

       

       // specify the position to place the text

       int x = image.getWidth() / 3;

       int y = image.getHeight() / 3;

       

       // draw the text on the image

       Graphics graphic = image.getGraphics();

       graphic.setColor(Color.RED);

       graphic.setFont(new Font(&quot;Arial&quot;, Font.BOLD, 40));

       graphic.drawString(text, x, y);

       

       // return the image to client

       ImageIO.write(image, &quot;jpg&quot;, response.getOutputStream());

    }</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Make sure you put the image file <span style="font-family: Courier New"><font size="2">MyCar.jpg</font></span> under the <span style="font-family: Courier New"><font size="2">WebContent</font></span> directory. The servlet will load the image from this location.<br />
<br />
<br />
<b><font size="3">Run the project</font></b><br />
<br />
We have done the coding part. Now let’s see how the application works by running it on Tomcat server. In the <i>Servers</i> view, right click on the server name, select <b>Start</b>. Open a browser window, then type the following URL into the address bar:<br />
<a href="http://localhost:8080/ImageServlet/" target="_blank" rel="nofollow">http://localhost:8080/ImageServlet/</a><br />
<br />
The port number may be different because it depends on your Tomcat’s configuration. You should see the following screen:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2840d1328374045-compatibility-dual-core-procesors-run-1.png" border="0" alt="Name:  Run 1.PNG
Views: 503
Size:  24.1 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Access the application home page</b></div><br />
The page is displayed with a text field and a Submit button. Type some text, such as <i>Lamborghini 2012</i>, and hit <b>Enter</b>. You should see the following screen:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2841d1328374132-compatibility-dual-core-procesors-run-2.png" border="0" alt="Name:  Run 2.PNG
Views: 519
Size:  561.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Result after submitting form to the servlet</b></div><br />
And voila! The image is added with the text we have typed. That indicates the servlet is running properly, as expected!<br />
<br />
<br />
<b><font size="3">Packaging the application</font></b><br />
<br />
A Java web application is commonly packaged as a <i>web archive</i> (WAR) file. A WAR file can be deployed on all web servers that support Java. Right click on the project name in the <i>Project Explorer</i> view, select <b>Export</b> -&gt; <b>WAR File…</b> In the <i>Export</i> dialog, specify the path of the WAR file in the field <i>Destination</i>, then click <b>Finish</b>:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/2842d1328374302-compatibility-dual-core-procesors-export-war.png" border="0" alt="Name:  Export WAR.PNG
Views: 497
Size:  18.4 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Figure: Generate a WAR file</b></div><br />
So far you have been seeing some concepts about Java servlet and use Eclipse IDE to write an interesting web application that works with a servlet. You also understand how a servlet works throughout the example and how Eclipse IDE can be used to develop a Java web application.</blockquote>

]]></content:encoded>
			<dc:creator>Eclipse</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/eclipse/791-working-java-servlets-eclipse.html</guid>
		</item>
	</channel>
</rss>
