Eclipse

Articles
Videos

Subclipse
Maven
Shortcuts
Tomcat

Out of memory problem with Eclipse or Ant
Dealing with projects that have circular dependencies

How can we import an existing project?

  1. If its already a Eclipse Project, then simply go to File->Import->General->Existing Project into Workplace.
  2. Otherwise define project type e.g. Java, Web etc Create a new project of type you define into your workplace. Copy Paste source , lib and other necessary files. refresh, compile and run project in eclipse.

How can we format code?

  1. CTRL+SHIFT+F (on Windows) or COMMAND+SHIFT+F (on Mac)

How to undock a view?

Just drag the view to the outside of your Eclipse window.

Does Eclipse support multiple clipboards?

Yes and No. By default, Eclipse does not seem to support multiple clipboards. However, there are Eclipse plugins that you can install. I use | More Clipboard. Other solutions or plugins: Multi Clipboard, http://stackoverflow.com/questions/2147679/eclipse-stack-or-pile-for-cut-copy-paste, http://ditto-cp.sourceforge.net/, http://blog.maestropublishing.com/2012/08/14/mutiple-clipboard-plugin-for-eclipse/, http://robertmarkbramprogrammer.blogspot.com/2010/05/setting-persistence-file-for-eclipse.html

To create a new Java project:

File -> New -> Java Project

To create a new Java class for your project:

File -> New -> Class

To compile and run a Java program:

Click on the "Run" button at the top and look at the console window. You can also click on the "Run" menu and select the "Run" option.

To show the line number:

Windows -> Preferences -> General -> Editors -> Text Editors -> Show line numbers

How to configure Eclipse to show heap space?

Windows -> Preferences -> General -> Show heap status

The heap size indicator on the lower right corner of your IDE. This indicator displays the maximum JVM heap size and how much of it is being used. Another useful feature of this indicator is the ability to garbage collect the heap. Simply click on the bin icon in the indicator to immediately schedule the heap for garbage collection. If you are lucky it will free up some heap space. There is also a context menu on this indicator. Simply right click to pop it.

How to delete unwanted workspace?

Windows -> Preferences -> General -> Startup and Shutdown -> Workspaces.

Note that this does not actually delete the files from the system, it simply removes it from the list of suggested workspaces. It changes the org.eclipse.ui.ide.prefs.

How to get Eclipse to re-recognize an old deleted workspace?

Just use the switch workspace functionality. Select Other and then select the old directory. This only works if you did not previously delete the directory associated with the old workspace.

In Eclipse, how can we display two files so that their content are both visible at the same time?

Drag the tab for the file around until the cursor change to thick black arrow. You can split the screen vertically if you drag the tab to the right edge of the screen. You can split the screen horizontally if you drag the tab to the bottom edge of the screen.

In Eclipse, how can we open the same file in multiple tab?

You can use right click on the tab, and chose New Editor. Changes that you make to one editor instance will be displayed in the other editor instances. However, you can scroll each editor instance independently.

How to install a plugin?

  1. Go to Help -> Install New Software
  2. Click on the Add button
  3. Give it a name
  4. Provide the update URL
  5. Click OK
  6. Click "Select All"
  7. Select appropriate check boxes if necessary
  8. Click Next -> Next
  9. Accept the license agreements
  10. Click Finish

See http://www.youtube.com/watch?v=T7t5daTM-T8

Some plugin has a download page on which there is an install icon. You can drag this install icon and drop it onto a running Eclipse workspace to install the plugin.

How to import a project using Subclipse?

  1. Right click on the Package Explorer
  2. Click on Import
  3. Drill down on SVN
  4. Click on "Checkout Projects from SVN"

How to re-map a shortcut?

I've become increasingly annoyed that in order to run an ant script I have to use ALT + SHIFT + X,q. To re-map this shortcut to F7, click on Window > Preferences > General > Keys. Look for the "Run Ant Build" command (you should be able to use the filter box at the top to quickly locate the desired command). Click on the command, and then highlight everything in the Binding box and hit the Delete key and then press the F7 key and click OK.

Integration with Vim (Using Vim as an embedded editor inside Eclipse):

How can we get Eclipse to automatically generate setters and getters for a class?

  1. Right click anywhere in the editor
  2. Select Source -> Generate getters and setters.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License