How to run the programs with Eclipse?


A scientist has to learn how to use tools do do experiments. Programmers also use tools to construct and run programs. You are suggested to first follow the instructions with a very simple non graphical tool. In this article we explain step by step how to download, install and use a very popular graphical application called Eclipse. It is free.

I know a person who knows about Java and Eclipse
I want to learn how to run the programs with Eclipse by myself  
    1. Install and run Eclipse into your computer
    2. Download the programs from this website into your Eclipse
    3. Execute the Java programs with Eclipse



I know a person who knows about Java and Eclipse


Wonderful! Seek help from a teacher, a coworker or a friend familiar with programming. Show this web page to that person. Tell them you need help executing programs written in Java version 1.5. You will quickly be up and running.

I want to learn how to run the programs by myself

1. Install and run Eclipse into your computer


Important prerequisite: you must first install the Java Development Kit. Eclipse requires a JRE or JDK to start because Eclipse is itself a - sophisticated - Java application with millions of lines of Java code. JDK and Eclipse are both free.

Caveat: the following instructions are for Windows users only. Linux and Mac users should visit the main Eclipse download page. Instructions will vary sensibly if your configuration does not exactly match the one used here - Windows XP, no Winzip. We still hope the detailed screenshots will be helpful to get you started if you don't know anyone familiar with Java and Eclipse.

1. Click on Eclipse IDE 3.5 for Java developers on Windows to download the Eclipse application. The following file download dialog appears. Select 'Open'.

File Download dialog

2. Wait a few minutes while the eclipse application is downloaded to your computer. Go and enjoy a snack or a coffee and when you return you should have the following window on your screen. Note if you use Winzip, instructions below will not directly apply but will remain very similar.

Zip file containing Eclipse

3. Click on 'Extract all files' in the window above. The Extraction Wizard shown below comes up. Click 'Next'.

Uncompress Wizard

4. Type in c:\ to install Eclipse under your C: drive. Click Next.

uncompress into c drive

5. Wizard has completed the installation of the program Eclipse a few moments later. Click Finish.

Wizard completed

6. To start Eclipse, find the Eclipse folder under your C drive in the Windows Explorer. Double click on the eclipse folder to open it.

Eclipse folder in Windows Explorer

7. Inside the eclipse folder, find the program named eclipse.exe. It has a purple icon. Double click on eclipse.exe to start Eclipse.

Eclipse executable

8. During the startup, Eclipse asks you to specify the location of the workspace - where we will store our Java programs. Use C:\workspace as indicated in the screen below. It is suggested you check the option 'Use this as the default and do not ask again'.

Eclipse startup

9. Eclipse shows up on the screen. Create a new Java Project from the menu File, New, Java Project - as indicated below.

Menu Java Project

10. Name the new project science. Select 'Use project folder as root for sources and class files' as shown below. Click Finish.

New project wizard

11. Close the welcome page by clicking on the red button shown below.

Welcome page

2. Download the programs from this website into your computer

1. Click on the link Program - PseudoRandom.java to download this Java file into the folder C:\workspace\science

You can repeat this step for every program you want to download. The list of Java programs is shown at the main site.

3.Execute the Java programs with Eclipse

1. Click on the science folder as indicated by the arrow marked with an A below. Press the F5 key on your keyboard to refresh Eclipse. The program PseudoRandom.java appears. You can double click on this file - arrow marked with a B. The program is opened in an editor which you can use to modify this program when going through the exercises - area marked with a C.

java perspective

2. Select PseudoRandom.java - arrow D - and click the white arrow in a green circle to start the Java program PseudoRandom - arrow E.

Start java program

Congratulations! You have started a Java program with the Eclipse application. You can edit the program - area C - save it with the menu File / Save, and start the modified program again - arrow E.

Java application executing