Monday, December 14, 2009

Using Eclipse IDE: Tips, Facts and Tricks

  • If a value gets stuck in Eclipse caches/preferences that doesn't make sense and you can't find a way to update to the new value using Eclipse GUI:
    • Search the workspace/.metadata folder for the obsolete value and correct it, esp. the .settings files. Don't touch binary files, unless you know what you're doing.
    • clean the Eclipse cache by starting exlipse, just once, with the first command line argument set to -clean
    • export preferences, switch to a new workspace and re-import the saved prefs.
    • reinstall Eclipse
    For more info see this great article.
  • The Project Delete doesn't delete any files from the project directory, not even from the .settings folder, unless you check the Delete files... checkbox. Question: is any information lost if I delete a project and then re-import it?
  • How to add a .jar file to classpath without using absolute paths? Follow these steps:

    • Go to Windows > Prefs > Java > Build Path > Claspath variable. Add a new variable pointing to the jar or to a folder, if there are many jars to add.
    • Go to Java Build Path of your project and click Add Variable. If you have specified a var pointing to a single jar, just select it and click OK. If you have created a var pointing to a folder, select it and click Extend. Then, select the jars you want to add (you can add them all in one step). Click OK.
  • How can I move project to another folder? For me this works:


    • Delete the project
    • Move the folder
    • Re-import the project
     

    No comments: