Download Eclipse:

  1. Download either Eclipse 3.0 or 3.1 from Eclipse downloads using University of Buffalo's mirror to your PC. Extract all files within this zip into your C: drive.
  2. Read the README file inside of the Eclipse folder to see which version of java it uses and download that version if you don’t already have it.
    **Make sure that you only have one version of java in your computer’s Path (Start -> Settings -> Control Panel ->System -> Advanced -> Environment Variables -> Path ). If you have multiple versions, make sure to put your new version at the front: C:\”java package number”\bin (Example: C:\j2sdk1.4.2_08\bin if your java version is 1.4.2_08).

Using Eclipse 3.0:

  1. Open up Eclipse.
  2. Make sure the workspace is not saved to a directory with a space in its name (Example: Documents and Settings).
  3. Create a new project: File -> New -> Project ->Java Project (or plug-in) and follow their dialogs to enter the project's information.
  4. To use an existing project, create a new project and right-click on the project's name -> import -> File System -> and follow the dialog to find your existing files.
  5. To export your project into a folder: right-click on the project name -> export -> pick type of export -> follow the dialog to locate target directory
  6. To run a project: Run -> run… -> New (bottom left) -> check that the main file is selected -> Argument (tab on top) -> paste the following into the vm argument text box:

    -Djava.library.path=${system:ECLIPSE_HOME}/plugins/org.eclipse.swt.${system:WS}_3.0.2/os/${system:OS}/${system:ARCH};

    This copying and pasting will prevent Eclipse from complaining that library files are not in its run-time path.
  7. To use swt or jface files: import swt/jface files at the top (Eclipse will complain and suggest ways to fix this complaint) and include the jar files by right-clicking on the project name -> properties -> Java Build Path -> libraries tab -> Add External Jars -> find the location of your jar files (Example: your swt.jar might be in C:\Eclipse\plugins\org.eclipse.swt.win32_”version number”\ws\win32) -> OK
  8. The way hierarchies are established in Eclipse is by using a dot. So A.B will notify Eclipse that B is a child of A.
  9. If you would like to produce javadoc at the end of your project, make sure that the templates are set up to automatically provide repetitive comments for new files, types, methods in Window -> Preferences -> Java (click the plus icon) -> Code Style -> Code Templates.

Using Eclipse 3.1:

  1. If your program uses SWT: Download the SWT Binary and Source for Windows (swt-3.1-win32-win32-x86.zip) from the Eclipse downloads page.
  2. Use the downloading mirror from University of Buffalo
  3. Save this file to your C: drive
  4. Open up C:\eclipse folder, double-click on eclipse application (blue eclipse as icon)
  5. Make sure the workspace is not saved to a directory with a space in its name (Example: Documents and Settings).
  6. You will see the welcome page: you can take time to do the tutorials or click on arrow(top-right) to go to workbench
  7. Go to File -> import... -> "Existing Projects into Workspace" -> "Select archive file:" and use the Browse button to locate the SWT standalone archive you just downloaded -> "Finish" button. A new project called "org.eclipse.swt" should appear in your project hierarchy view.
  8. To create a new project: Go to File-> new -> Project -> java project -> name the project -> click Finish
  9. To import existing files into the project: Right-click on the project’s name -> import -> File System -> and follow the dialog to find your existing files. Always click import from the level above package names to avoid package name confusions or creation of default packages (For example: in jcmlog, trickle all the way to package/jcmlog/edu/stanford/slac/jcmlog then click finish).
  10. If project name is incorrect, will get errors during import on which files to include (Ignore all SWT-related errors). If this error occurs: Right-click on the project's name -> go to properties -> buildpath -> libraries -> remove all libraries except JRE (if others exist)
  11. If your project uses any graphical interfaces, Right-click on project name -> properties -> java build path -> libraries tab -> Add external jars -> org.eclipse.swt_win32.x86..jar + org.eclipse.jface_3.1.0.jar + org.eclipse.core.runtime_3.1.0.jar (for jcmlog) or any other jars required by your project. If your project uses SWT, go to Projects tab -> Add... -> select org.eclipse.swt -> ok -> ok
  12. In the Navigation view, Select the file in your project with main() (Jcmlog.java for jcmlog). Go to menu option Run -> run.. -> Java application -> new -> check that the main class is selected -> Run
  13. To use a properties file: Go to Run -> run...-> Arguments tab -> in vm arguments, type:
    -Djcmlog.propertiesName=**NameOfFile**.properties (..the entire path.../defaults.properties in the case of jcmlog) -> ok
  14. If you would like to produce javadoc at the end of your project, make sure that the templates are set up to automatically provide repetitive comments for new files, types, methods in Window -> Preferences -> Java (click the plus icon) -> Code Style -> Code Templates.

Programming caveat:

  1. SWT cannot handle more than 1 synchronous thread accessing the GUI. To avoid “illegal thread access” errors, make sure all extra threads are asynchronous by using the Display.async method.