Rutvij's Odyssey

Life of a Developer and Technologies he plays with

Posts Tagged ‘Shortcuts

Useful Eclipse Shortcuts for Java Developer

leave a comment »

Eclilpse is one of the most popular IDE for JAVA based development projects. As we know every technologies and tools comes with its own learning curve. Althaugh eclilpse is very easy to use but still lot  of the developers are not using it at its fullest capacity.

Here  in this post I will  show some very useful Eclipse shortcuts which will be useful for you in your day to day development.

  1. Get rid of  manual Import statements  : Organize Imports ( Ctrl+Shift+O)
    After  you write a line of your code you may need to Impot classed used in your code.Otherwise eclipse will show  errors as you can see in this image. Organize Import will import classes if found from class path of your project.

  2. Quickly Go to File : Open Resource ( Ctrl+Shift+R)
    Project we have several packages, in order to go to the particular file developer need to traverse to file through packages/folders in Navigator /Package view.For  example I am looking for BaseModelImpl.java file  instead of going through all packages/folders
    Do : Open Resource ( Ctrl + Shift + R  ) and type BaseImpl it will show all files starts with BaseImpl you can select the file you need and  press OK to open. It supports  RegEx so you can type like Ba*Im*.java also to filter your search.It can locate any file in your project not limited to .java files.

  3. Quickly locate JAR which contains ‘the class’Open Type ( Ctrl+Shift+T)
    Several times I need to  know which particular  JAR contains the class I am interested in. For Example  I have couple of projects in workspace and I copy paste few lines from other project.Its giving errors as Eclipse not able to resolve classes. As its working in other projects,  I need to know which JAR file this class contains and I need to copy that jar file to my project and/or set in classpath.

  4. Jump to Last Edit Location : (Ctrl+Q)
    Working with multiple source files is reality of development . When you are working with multiple source files and need to know in which file you made last changes you can easily Jump to last Edit Location using ( Ctrl+ Q).
  5. Locate where this method is reffered in projects : (Ctrl+Shift+G) (Quick Search)
    In order to know where this particular method/variable is reffered not only in this project but other projects of workspace also.
    Select method in Editor and do Ctrl+Shift+G. In search view Eclipse will search its references in all projects in current workspace.

Written by rutvijshah

December 5, 2009 at 5:14 pm

Posted in Eclipse IDE

Tagged with , ,