III    Getting Started

This chapter describes how to get to the point where you can start writing your first piece of code.

Creating a Kenya Project

In Eclipse everything is done in Projects. There are different kinds of projects for different kind of purposes, such as Java Projects for Java or Kenya Projects for Kenya.

All your work with Kenya should be put into Kenya Projects.

  1. Inside Eclipse select the menu item File > New > Project.... to open the New Project wizard. Select Kenya Project in the Kenya folder then click Next.

    How to open New Project wizard
    Alternatively, if the Kenya perspective was already open, then you can right click into the Kenya Explorer and select New -> Kenya Project from the menu.
    Alternative (faster) method of opening New Project Wizard
  2. On the next page, type a name in the Project name field and click Finish. The Kenya perspective automatically opens inside the workbench with the new Kenya project in the Kenya Explorer. The project is stored on disc in your workspace folder. The Kenya Explorer presents this as a logical location in which you can create, delete and modify files.

Creating a new Kenya file

The Kenya file is the smallest unit inside KenyaEclipse. Each program you write resides in its own file. The New Kenya File wizard makes it easy to create a new program in Eclipse.

  1. Inside Eclipse select the menu item File > New > Other to open the New wizard. Select Kenya File in the Kenya folder then click Next.

    How to open New File Wizard
    Alternatively, if the Kenya perspective was already open, then you can right click into the Kenya Explorer and select New -> Kenya File from the menu.
    Alternative (faster) method of opening New File Wizard
  2. The next page asks you to select a container, which is by default the last selected folder or project on the Explorer or navigator. You are also asked to enter a Type name. This is both the filename and what is in Java known as the Class name. You will notice that certain names are not permitted by convention and you will be given a reason why. The last thing asked is whether you would like to generate a main method. Since all Kenya programs require a main method to be present, the default is to create one without arguments. The main method will be automatically inserted into the new file, so that you do not need to type it yourself. This is just one of the ways in which an IDE can speed up your development.

    New File Wizard
  3. The new file will open in the Kenya/Java editor. If you have not yet switched to the Kenya Perspective, you should do it now. You are now ready to start programming your first Kenya application using KenyaEclipse. How to use the editor and its features is explained in the next chapter.