Tipsy Tips for Eclipse


Add files to java project:
 (1) Via File →Import→General→File System and select files from a folder.
 (2) Put files in the source subfolder of the project folder and Refresh the project (F5).
 (3) Drag files from file system (Windows Explorer) into Eclipse's Package Explorer at the correct location.
 (4) Before creating the project: create project folder, copy files to that folder and create a project with the folder name → the files are added automatically to the project.

Jar file = java library = zip-file with class files which are in a folder structure corresponding to the package name. For the org.workbench.tutorial.Book.class, the Book.class file must be in org\workbench\tutorial.

When running a java program from eclipse, the necessary libraries must be included in the project. When running from outside eclipse, they must be in the lib or lib\ext folder of the java version of the path they are in must be included in the CLASS_PATH environment variable.

          When your cursor is placed on a variable or method, its definition is shown in a second. If not, press F2 to reveal it.
          When selecting a variable/class or method, pressing F3 brings you to it's definition (if available).
          Press  or Alt+Left arrow to go back to your previous location. Use to go back to your last edited location.
          During programming, Ctrl+space shows you a list of possible continuations.
                   For example, with an object and the dot symbol it gives the list of attributes/methods of the class. Or when you typed just the first letters of the variable or method.
                   Use Ctrl+space when using a class for the first time from a different package: the corresponding import statement is automatically added!
          Press on the error symbol  in the margin to get a list of possible corrections.
          Comment or Uncomment pieces of code by selecting it and pressing Ctrl+/.
          Learn to use the powerful debugger:
                   Put or remove breakpoints by right clicking in the left margin of your code and choosing Toggle breakpoint.
                   Start your program with the debug icon . Your program will execute until it meets the first breakpoint.
                   Eclipse switches to the Debug Perspective containing a Variables view in which you will see the values of the variables. When selecting an object, it prints the object using the toString() method.
                   Use Resume  (F8) to let the program continue to the next breakpoint. Alternatively, choose step-by-step execution with Step Into  (F5),  Step Over  (F6) or Step Out  (F7).

          Rename classes, methods, variables with Refactor => Rename (Alt+Shift+R): all references to it are updated too!! When renaming a class, the corresponding java file is renamed too.
                   You can freely move classes from one package to another or from one project to another. All references to it will be properly updated.

          Find out where your class, method or variable is used in your project or the entire workspace: Search => References (also via quick menu).
          Reserve extra memory for your program: select the Run configuration under and add a VM argument (Arguments tab): -Xmx256M (allocates 256MB).