eclipse

recent posts related to the eclipse ide

Eclipse build path - How to add a new jar file to your Eclipse build path alvin January 13, 2010 - 9:56am

When you're working with a Java project in Eclipse and you need to add a new jar file to your project, you don't need to close down Eclipse or your current Eclipse project (as I've seen a few people do). In fact, here are all the steps you need to take to add a new jar file to your Eclipse build path:

How to see the source code for JVM classes in Eclipse alvin November 30, 2007 - 4:11pm

When using Eclipse straight out of the box, if you click on a Java-provided class, like the FileWriter class, you won't get much help when the Eclipse Class File Editor is shown. All you'll see is some binary information, with these messages at the top of the file:

Source not found
The jar file classes.jar has no source attachment.
You can attach the source by clicking the Attach Source below:

(The message really should end with "by clicking the Attach Source button below:")

Eclipse can generate Java hashCode and equals methods

A nice feature of Eclipse is that you can easily generate hashCode and equals methods for your Java class using the editor. You'll really appreciate this capability when you need to create these methods whenever you're doing anything related to sorting, comparisons, comparators, etc.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

Let Eclipse suggest variable names with control-space keystroke

I just learned that Eclipse can automatically create (or suggest) variable names for you. The suggestions are based on the class of the object you're about to create, and any characters you've typed for the variable name so far.

For example, if I'm in a method and I type Connection, followed by a space, then press the [Control][Space] keys, Eclipse adds a variable named connection, so my line changes to Connection connection.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

Show the method signature with control-space keystroke alvin November 28, 2007 - 10:39am

Using Eclipse, if your cursor is positioned in between the parentheses of a method call, the [Control][Spacebar] keystroke will show you the signature of the method, i.e., the parameters that the method accepts. I just read where the documentation shows that you should use the [Control][Shift][Spacebar] keystroke to see method parameters, but I've found that [Control][Spacebar] works fine for me.

Expand "sys" to "System.err.println" with control-space alvin November 28, 2007 - 10:36am

I've just recently started using Eclipse a lot, and I just typed System.err.println() one more time than I cared to. I just looked it up, and Eclipse also has templates, and one of the pre-built templates lets me type sys, then hit the [Ctrl][Spacebar] keystroke. This brings up a list of options I can choose from, one of those options being to insert the System.err.println() text in place of my sys text.