View RSS Feed


Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system.

  1. Eclipse - Classpath variables

    by , 11-04-2011 at 06:46 PM (My Java Tips)
    A classpath variable can be added to a project’s class path. It can be used to define location of a JAR file that is not the part of workspace. Non modifiable class path variables are set internally like JRE_LIB, JRE_SRC, JRE_JRCROOT.

    To define a class path variable in Eclipse, open preferences by clicking Window > Preferences from the menu bar. You will find class variables under Java > Build Path. There you can define new class variables.

    Name:  eclipse-classpath.PNG
Views: 265
Size:  16.2 KB ...
  2. Eclipse Debugging

    by , 11-04-2011 at 06:44 PM (My Java Tips)
    Following are Eclipse debugging features: Breakpoints, Step into, Step over, Step return, Step Filters, Watches, Run to line, Suspend/Resume/Terminate. You should know each of these for debugging your Java programs. I will try to introduce these in the next few posts.

    We use breakpoints in our Java source to cause the thread of execution to suspend and return to the debugger. To set breakpoints in Eclipse, simply double-click the left margin.

    Use ‘Step Into’, to execute ...
  3. Viewing all breakpoints

    by , 11-04-2011 at 06:36 PM (My Java Tips)
    In this post, I will talk about how to view all the breakpoints in a project/workspace.

    You set breakpoints for debugging. If you have too many of them, then it becomes difficult to manage those. At some point, you would like to see all the breakpoints in a view so you can remove the unwanted ones. Eclipse has a breakpoints view. You can find it under:

    Windows > Show View > Other > Debug > Breakpoints

    Name:  breakpoints.PNG
Views: 118
Size:  16.5 KB
  4. Colapse all

    by , 11-04-2011 at 06:17 PM (My Java Tips)
    You are working in a Eclispe workspace that involves many projects. If you want to refresh all the projects or just simply if want to see all project names without their sub folders and files, you have to collapse all projects.

    In the package explorer, you will be viewing all the projects. To collapse each project, you can click the minus symbol for each project. But this is painful as too many clicks are required in case of too many projects.

    Eclipse provides ‘collapse ...
  5. Folding

    by , 11-04-2011 at 06:14 PM (My Java Tips)
    I will introduce folding option provided by Eclipse which is very helpful if you wish to fold (collapse) elements of a class.

    You might have experienced a situation where you have a class with lot of methods and comments. You may wish to collapse all the comments, or the methods or both to have a bird’s eye view of what the class is offering.

    Name:  foldin_option.PNG
Views: 139
Size:  31.0 KB

    Right click on the left most line (border) of the class. A window will open in which ...
  6. M2Eclipse (Tycho)

    by , 11-03-2011 at 06:35 PM (My Java Tips)
    Maven can be integrated in to Eclipse my using M2Eclipse (Tycho). Is is true to say that it is the most mature of the Eclipse integration projects.

    Worth mentioning features of M2Eclipse include:

    - Launching Maven builds from within Eclipse
    - Dependency management for Eclipse build path based on Maven's pom.xml
    - Resolving Maven dependencies from the Eclipse workspace without installing to local Maven repository
    - Automatic downloading of the required ...
    Eclipse , Maven
  7. Converting an existing project to an EclipseME project

    by , 11-03-2011 at 06:32 PM (My Java Tips)
    Eclipse provides ‘Convert to J2ME Midlet Suite’ from the project pop-up menu to convert an existing Java project to EclipseME project. Let me show how to do that.

    When you select ‘Convert to J2ME Midlet Suite’’, you will be prompted for the appropriate device definition by the EclipseME plug-in. This plugin will then make the required changes to your project.

    When you convert a J2SE project to an EclipseME project, the J2SE libraries have to to be removed from the build ...
    Eclipse , Java ME
  8. Creating J2ME MIDlet Project

    by , 11-03-2011 at 06:31 PM (My Java Tips)
    Many guys who are new to mobile application development often question: “Does Eclipse support MIDlet development?”. Yes it does. In the next few posts, I will explain how you can create a J2ME project in Eclipse.

    To cleate a EclipseME project, we should use the New Project Wizard and select J2ME Midlet Suite from within the J2ME item.

    Name:  j2me_midlet_suite.PNG
Views: 400
Size:  9.8 KB

    You will then see a wizard pane which is actually the standard for almost all Eclipse projects. ...
    Eclipse , Java ME
  9. View for warnings and problems

    by , 11-03-2011 at 11:40 AM (My Java Tips)
    Eclipse has a view that shows all the warnings and errors of the projects in your workspace. I will write about that in this post.

    While working on Java projects involving lot of packages and classes, you want a view to show you all the warnings and errors in your work. This will present all wrong stuff in a single view and you don’t need to search for the errors manually. Eclipse provides a view called ‘Problems’ that serves the purpose.

    Name:  viewprob.PNG
Views: 165
Size:  17.9 KB ...

    Updated 11-03-2011 at 11:42 AM by Java Tip

  10. Tunning Eclipse

    by , 11-02-2011 at 06:15 PM (My Java Tips)
    Sometimes you might feel that your Eclipse is sluggish and performance tuning is required. I will address this issue in this post.

    Implement the following for better performance:

    - Increase your min/max memory settings from 40/256 to 256/512 or higher. You might have to experiment with the min/max setting but increasing the initial memory heap to 128 when Eclipse starts should help.

    - Disabling the code folding feature also helps. To disable this, go ...
  11. Resolving OutOfMemoryExceptions

    by , 11-02-2011 at 06:13 PM (My Java Tips)
    You might have encountered OutOfMemoryException using Eclipse. This post is about solving this issue.

    OutOfMemoryException is caused by too little heap space for virtual machine. Adjusting the maximum heap space with something like -vmargs -Xmx256m works. This gives your Java apps more space to run and this always helps performance. There are situations where even with an enormous heap size you can still end up with OutOfMemoryException. This means that your VM is not running out ...
  12. Go to Line

    by , 11-02-2011 at 06:00 PM (My Java Tips)
    Jumping to a specific line is very useful feature. Ecplise provides line nos along the lines of code and you may just to the required line using 'Go to Line' feature.

    Name:  jump-line.PNG
Views: 133
Size:  26.4 KB
    Ctrl + L, enter line number and you are taken to the required line. Of course if the stack trace is in the Eclipse console, you can just click the hyperlink. But if it’s in a log file or something, just use this shortcut to go to the line in a sec.

    Name:  jump-line.PNG
Views: 133
Size:  26.4 KB ...
  13. Go to other open editors

    by , 11-02-2011 at 05:56 PM (My Java Tips)
    You can have a lot of files open your Eclipse IDE and may want to switch the file while working. Eclipse provides a fast way of dong that.

    You can cycle through the editors using Ctrl + F6 but its not that useful since the keys are requires you to keep the Ctrl key down. Better way is to use Ctrl + E and then either use the arrow buttons, or type the name of the file you’re editing.

    Name:  editorswitch.PNG
Views: 124
Size:  57.6 KB
    I hope you will find this useful.
  14. Open a type

    by , 11-01-2011 at 06:26 PM (My Java Tips)
    Opening a type for example: a class, an interface) without clicking through interminable list of packages really is a handy feature. The shortcut key combination is: Ctrl + Shift + T.

    If what you want is a Java type, this shortcut will do the trick. Unlike the previous shortcut, this even works when you don’t have the Java source file in your workspace for instance: when you’re opening a type from the JDK).

    Name:  typeopen.PNG
Views: 127
Size:  77.8 KB

    try this. ...

    Updated 11-01-2011 at 06:29 PM by Java Tip

  15. Content Assist

    by , 10-30-2011 at 05:05 PM (My Java Tips)
    Eclipse provides content assist that really can save lot of development time. For instance putting try catch blocks where needed, for loop to iterate over an array/list etc.

    Key stokes required: Ctrl-Space

    Here is a list of useful things that can be done using content assistant:

    - Code completion, name completion, etc.
    - Does lots of useful completions in different contexts. Try it!
    - When the cursor is among the methods of a class declaration, ...
  16. Eclipse - Key Binding Assistance

    by , 10-28-2011 at 07:20 PM (My Java Tips)
    Using keyboard shortcuts while working in Eclipse saves a lot of effort. But some shortcuts are not easy to remember and some comprise of multiple keys like: Alt+Shift+Q Y" ("Open Synchronize View").

    Eclipse provides a little pop-up showing you the possible completions for the keys you have pressed already. In the preferences, under General > Keys, there is an "Advanced" tab. Go to this tab, and check "Help Me With Multi-Stroke Keyboard Shortcuts". ...
  17. Eclipse - Creating path variables

    by , 10-28-2011 at 06:59 PM (My Java Tips)
    This post is about setting class path variables.

    When creating a linked folder or file, you can specify the target location relative to a path variable. By using path variables, you can share projects containing linked resources without requiring team members to have exactly the same path in the file system. You can define a path variable at the time you create a linked resource, or via the General > Workspace > Linked Resources preference page.

    Name:  path-vars.png
Views: 274
Size:  14.1 KB ...

    Updated 10-28-2011 at 07:04 PM by Java Tip

  18. GoogleTalk in Eclipse

    by , 10-27-2011 at 06:58 PM (My Java Tips)
    Eclipse communication Framework is a collection of communication and collaboration tools. One of exciting tool is support for talking to any Jabber server. This means that we can easily configure Google Talk to run inside an Eclipse view.

    You should have Eclipse Europa and ECF installed. To install ECF, go to Help -> Software Updates -> Find and Install > 'Search for new features to install'. The Europa Discovery Site ( should be ...
  19. Eclipse - Quick Access

    by , 10-25-2011 at 07:11 PM (My Java Tips)
    Eclipse Europa introduces a noteworthy feature called Quick Access . Using it where needed can save time and money.

    The Quick Access is your window to; perspectives, views, open editors, commands, menus. After pressing Ctrl + 3, start typing, and it will show you the possible matches. It filters the most likely ones first, but if you press it again, will show all the possible matches that it knows about.

    Those of you who have used Ctrl+E to open up the list ...
  20. Stack traces

    by , 05-24-2011 at 01:28 PM (My Java Tips)
    You must have seen stack traces in console window of your Eclipse. Good this is that Java stack traces in the console appear with hyperlinks. This means you can click these to go to the referred place in the code. This helps in problem identification.

    Here is how is works: place the mouse over a line in a stack trace and the pointer changes to the hand. Pres the mouse button and associated Java source file will be opened and the cursor will be placed at the corresponding line. Pressing ...
    Tags: stack Add / Edit Tags
  21. Running code with compile errors

    by , 05-24-2011 at 01:26 PM (My Java Tips)
    While coding in Java using Eclipse, you might have experienced situations where your Java class has some compile errors but stilly you want to run it. The reason might be that the problematic area might be invoked in your execution. What ever is the reason, Ill briefly explain how to execute code with compile errors.

    In Eclipse, you can run and debug code that did not compile cleanly. You cannot do this using command prompt. If line of code with compile error is executed, following ...
    Tags: debug, debugger Add / Edit Tags
  22. Debugger: Code Assist

    by , 05-24-2011 at 01:25 PM (My Java Tips)
    You might have used code assistant while coding in Eclipse. Its really useful and saves time for trivial stuff. Most of us think that code assistant is only available in code writing context. That’s not right.

    Code assistant is available in debug mode at following:

    • When entering a breakpoint condition,
    • In the Details pane of the Variables & Expressions view,
    • When entering a Detail Formatter code snippet,
    • When entering a Logical Structure code snippet,
    • When
  23. Scrapbook in Eclipse

    by , 05-24-2011 at 01:23 PM (My Java Tips)
    Consider the following scenario: you are working on a project with client specific APIs .You need to test some API methods before you put them in your real code. For that, you might consider a separate test workspace or defining a new test class in your running workspace. What about scrapbook page? Ever heard of it?

    Eclipse provide scrapbook pages to test write test code for experimental purposes. It is easier to use a Java scrapbook page than create a new class. A scrapbook page ...
    Tags: scrapbook Add / Edit Tags
  24. Setting watches in Eclipse

    by , 05-21-2011 at 10:55 PM (My Java Tips)
    Watch point is a special type of break point that suspends execution when specified filed is accessed or modified.

    Setting a watchpoint is simple. First select a field in the Outline view and choose Toggle Watchpoint from its context menu.

    Name:  watches.jpg
Views: 564
Size:  22.9 KB

    Now you have to configure this watchpoint. This is done by selecting the watchpoint in the view and choose Properties from its context menu. Don’t forget to configure the important properties ...
  25. Importing junit.jar

    by , 05-21-2011 at 10:52 PM (My Java Tips)
    Before you start writing unit tests, you must import junit.jar, so we have access to the testing framework. Follow these steps to import the required jar:

    • Right-click on the project name, and choose Properties.
    • In the tree on the left, select Java Build Path.
    • Next, choose Add External JARs… and browse to find junit.jar.

    It will be located in "<eclipsedir>\plugins\org.junit_<version number>\junit.jar".

    Once you successfully ...
    Tags: jar Add / Edit Tags
    JUnit , Eclipse
  26. Wrapping Strings

    by , 05-21-2011 at 10:50 PM (My Java Tips)
    Its always useful to wrap strings if they are too long. This provides better readability. Eclipse has support for this.

    String literals can wrapped when you edit them. Place your cursor at the point of literal where you want to wrap and press Enter. For example:

    Java Code:
    String message= "Java is fun to learn and it sure is a popular programming language.";
    I kept the cursor at ‘sure’ and pressed enter key. The String was changed to: ...
    Tags: string Add / Edit Tags
  27. Safe JAR file migration in Eclipse

    by , 05-21-2011 at 10:48 PM (My Java Tips)
    Its always a good idea to include refactoring information into the JAR file when you are exporting it from Eclipse. Eclipse’s JAR Export Wizard offers this option.

    Here is how it works:

    • File > Export
    • Select JAR file
    • Select: Export refactorings for checked projects

    This is very useful because then all the clients that are using older version of JAR will be able to migrate an old version of the JAR file to a new one using the Refactor > Migrate ...
    Tags: jar, refactoring Add / Edit Tags
  28. Searching methods with some return type in Eclipse

    by , 05-21-2011 at 10:47 PM (My Java Tips)
    Working on a project, I need to search all the methods defined in my workspace or in a package or in a class with a specific return type. Eclipse search feature (ctrl + h) provides support for this. We all have used eclipse search window a lot of times but many of us don’t know how to really use it to great affect.

    To search the methods with a specific return type, type

    Java Code:
    * String
    is used as wildcard for method name and String is the return ...
  29. Mark occurrences in Eclipse

    by , 05-21-2011 at 10:44 PM (My Java Tips)
    Mark occurrences is a nice feature in Eclipse. It simply marks/highlights all the occurrences of a variable, method or a type.

    This can be done by clicking ‘Mark Occurrences’ icon on the menu bar. If you like to use short cut keys, then use Alt+Shift+O. If you select methods return type, and mark occurrences is enabled, all the method exit points will be highlighted.

    Name:  mark-occurances.jpg
Views: 348
Size:  21.6 KB

    You may also select a super class or interface and then ...
  30. Hot Code Replace in Eclipse

    by , 05-21-2011 at 10:41 PM (My Java Tips)
    Ever heard of hot code replace in reference to debugging in Eclipse? Well, its sure is a powerful and useful feature. It enables you to change code while debugging. It simply means that you may change the code in debug mode and see its affect.

    Hot code replace is supported in 1.4 or higher VM. There are some changes like adding or deleting methods, class variables or inner classes which cannot be hot swapped. This depend on the support provided by a particular VM. This might also ...
Page 2 of 3 FirstFirst 123 LastLast