Archive

Posts Tagged ‘tricks’

Eclipse tips and tricks – Part 3

June 15th, 2010 3 comments

Here are a few more tips / tricks with which you can save time when you use the eclipse IDE.

Assign Key bindings:


Navigate to Window -> Preferences -> General -> Keys

You will find that there are many key bindings that are not assigned to actions that you might do on a daily basis. For example, when I start up on a new project, it is highly likely that I will introduce a lot of Value Objects (or Transfer / Data object, whatever you like to call them). A slick feature is to generate the ‘Getters and Setters’ for them using the ‘Source -> Generate getter and setter’ command from the Main menu.

You can either do that or you can assign a shortcut key to this action and get it done quickly. I use Alt+Shift+Q, +G (Yeah not the easiest combination. I know :) ). To restart eclipse I use Ctrl + F12. You might want to look at other bindings like

Categories: java Tags: , , ,

Eclipse tips and tricks – Part 2

September 5th, 2009 7 comments

Eclipse can be used to debug your java applications. Here are a few tips that can help you debug better

Remote debugging:

The eclipse IDE can remote debug your web application. Imagine being able to debug your development server from your local machine. Eclipse can help you do this. First you need to instruct your application / server to listen on a port for debug messages. That can be done using the -Xdebug flag

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8787,suspend=n

This tells the JVM to listen for specific debug messages on port 8787. In eclipse open Bug Icon -> Debug configurations and select “Remote java application”. Mention the port and server address and you should now be able to remote debug the application. Make sure that the classes and source sync with each other. On a network where the bandwidth is poor, this technique will not work.

Remote java application:

Categories: java Tags: , , ,

Eclipse tips and tricks – Part 1

August 30th, 2009 5 comments

Eclipse is a pretty good IDE to develop java apps on. However there are some features that you might not be using every day that can save you a lot of time.

Writing your own code templates is one of them. To write your own code template do the following

Go to Window -> Preferences. Select Java -> Editor -> Templates. You can add your own templates here. Templates are nothing but the code that auto completes when you press ctrl+space. For example type syso and ctrl+space. This will automatically fill in System.out.println() into the editor.

Eclipse code templates:
eclipse_code_template
Code template variables:

Eclipse can automatically fill out dynamic code by sniffing out variables in a template. Here are a few you should make yourself aware of

Categories: java Tags: , , ,