Running a program

The most efficient way of running a program is to create a workspace and then create a project in the workspace. This is done by clicking on Project/New Project. To simplify matters, click the Empty project icon. To create a new workspace, click Create a new workspace. In the slot labeled Location: browse for the directory you wish to place your project by clicking the button wih three dots to the right of the slot and then click the desired directory. When you find the desired directory, click it and its name will appear as the end of a path displayed in the slot. For example, if the path displayed was courses\fall02\v220101, the directory you clicked was v220101. In the slot labelled Project Name: type your project name. This will also be your workspace name. For addtional projects, follow the same procedure just outlined, but this time click Add to current workspace. Finally click OK. JCreator will create a Windows subdirectory with the same name as your project. To write your own program go to File/New, click Java File, fill in your file name in the Filename slot and make sure the Add To Project button is clicked. Below, we will describe how to run an applet; but for now we describe how to process applications. Compile your program by clicking Compile File; run it by clicking Execute File, both of these options are on the Build menu.

If you want to create a new project and add it to an existing workspace, follow the description in the first paragraph; but this time click Add To Current Workspace.

To write a Java applet, create a new project and in the New window click the Basic Java Applet icon in the Projects folder. After you follow the steps indicated in the first paragraph and close by clicking on OK, JCreator will create a Java program template with the name of the project, and as in the case of an application, it will create a subdirectory with the same name as the project. Use the appropriate parts of the template to write your program. JCreator will also generate an HTML file. If you write another applet in the project, you may change the executing statement in the HTML file and substitute the name of your new applet. To run an applet, first compile it and then execute the html file.

To obtain a project written in the past, go to File/Open Workspace and click the desired workspace. If it has more than one project, go to Project/ Set Active Project and select the appropriate project.

To see the white spaces in your program appear as dots, click the a.b icon on the extreme right of the second menu bar.

THE DIFFERENT VIEWS

There are three different views displayed in JCreator. The file view shows the program being written. You can have this view occupy the full width of the screen by clicking the left-most icon on the third menu bar.



Clicking the icon again restores this window to it's original size. This is called toggling. The class view displays the classes in your program. The icon to the right of the file-view icon toggles this screen. The package view displays in tree form the packages being used. We'll never use this icon. The icon that looks like a TV (the fifth one going from left to right), toggles full screen mode on and off for the file view.

CUSTOMIZING YOUR MENU

Click Configure and then Customize and click the Commands folder. Each time you click a menu title under category, all the options on that menu are displayed in the Commands window. For instance, under the Edit category, one of the options is Word Complete. If you drag this word to a menu bar, Word Complete will appear on the menu bar. If you type the first few letter of a word and then click Word Complete, JCreator will present choices for you to complete the word. Under the New Menu category, you can drag New Menu command to a menu bar and New Menu will appear on the menu bar. Now any command you drag to this menu title, will appear on this new menu.

SENDING THE OUTPUT TO THE OUTPUT WINDOW INSTEAD OF MSDOS WINDOW

Go to Configure\Options\. Click jdk Tools. From the Select Tool Type, pull down Run Application and click default. Click Edit and the Tool Configuration: Run Appplication dialog box appears. Click Capture output. Now your output will appear in the window below your program and you will be able to scroll the output if necessary.

If you want to use the command line during the execution of the program, also click Show command line.


Samuel Marateck
Aug 6 EDT 2001, revised Sept 1 2002