Building projects with Eclipse

This section explains how to build projects using psychWithJava and Eclipse. Applies to all OSs. Note: the screen shots below are from version 3.1. However the instructions should apply equally to newer version.

  • Create a new folder named examples under PsychWithJava folder. Under examples create another folder named HelloPsychophysicist
  • Download and the auxilary image files psychophysik.png and fechner.png under HelloPsychophysicist folder.
  • Start Eclipse. Click File -> New -> Project. Choose Java Project in the "New Project" Window, click "Next".

  • In the "New Java Project" window, click on the radio button next to "Create project from existing source". In the text field next to Directory enter the path to the directory where you placed the files that you just downloaded ( and the image files). Give a name to the project (top text field) and click Next.

  • In "Java Settings" click on the "Libraries" tab. Then click on "Add variable".

  • Highlight "psychWithJava" in the "New Variable Classpath Entry" window. Click OK. (You must have set up Eclipse to include psychWithJava package, if you haven't followed the instructions on Preparing Eclipse for pure Java development.)

  • Back in the "New Java Project" window you should now see "psychWithJava" in the build path list. Click Finish.

  • Now your project is created, and you should see a screen similar to the one below. (Note: to open and inspect any one of the programs in the "Editor" pane, simply double click on the file in the "Package Explorer" pane on the left hand side)

    This image is altered to fit the page. Click on the image to see it in its actual size

  • Inspect the file. To be able to use psychWithJava package you have to include an import statement
    import psychWithJava.*;
    Find that statement near the top of the file.
  • Running

    To run the HelloPsychophysicist example, right click on the file in the "Package Explorer" pane (CTRL-Click on Mac OS X) and choose Run As -> Java Application.

  •   Back