Eclipse templates for faster Java development

Dear Friends,

In this fast pace world of IT,where one need to deliver within tight schedules,shortcuts are nice way to expedite the task.Let us see some eclipse templates which can act as a shortcut and help in faster development in Java .

All the below screenshots are self explanatory.What you need to do is to press ctrl + space keys after typing the word.

For e.g ,if you want to have main method in your class,then type main and then press ctrl + space, select main and template of main method will be ready for you.

In the last two screenshots we will see settings for getting these templates work in eclipse.Basically you need to go to Windows ->Preferences->Java->Editor->Templates.There we will find templates for all these shortcuts and for a shortcut  to work, checkbox against that particular template needs to be checked.We can add custom template as well.

Screenshots of some examples


















Any feedback ,suggestions ,questions on the post are welcome.




Writing your first Java Program

Hello Friends,

If you have come to this page so that means you are Java enthusiast and looking forward to learn Java.Let me tell you Java is very easy to learn,if you learn some core concepts well.

Okay,Let us create a Java project and write a java program step by step as follow :

Step 1 : Let us install Eclipse(copying actually) on machine if it is not there already.Eclipse can be installed from

http://www.eclipse.org/downloads/

I downloaded Eclipse Luna for my 32 bit machine.

Step 2 : Install Java/JDK 1.6 from Oracle site.

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR

If you don't know steps required to install Java/JDK,please go through tutorial How to Install Java/JDK on your windows machine


Step 3 : Open eclipse by double clicking on eclipse.exe in eclipse folder that you have downloaded in step 1.

Note : For quickly opening eclipse in future,you can right click on eclipse.exe and select
1)Pin to Start Menu 2) Send to Desktop(create shortcut).

Step 4 : Right Click in the project explorer and select New ->Project and in the wizard type java project and select Java project  and click on Next.


How to get value of xml tags from a File

Hi Friends,

Sometime back I cam across situation where I had a very big file(it was log file actually) having multiple xml requests on multiple lines,so that means one xml request per line and I wanted to get values from one particular tag from each request.So I wrote program mentioned in below post,which gave me FileNames from each request.

Let us see now how we can get value of  xml tags from a big file.

Prerequisite :
IDE : Eclipse or any other IDE for java development.
JDK : I used JDK6
commons-lang.jar(I have used commons-lang-2.6.jar)

Step 1 : Create a new java project in eclipse