Intermediate Programming Instructor: Greg Shaw



Computer Programming I Instructor: Greg Shaw

COP 2210

Using the JCreator 4.5 IDE

This document explains how to create, save, compile, and execute a Java program using the JCreator IDE (Integrated Development Environment), 4.5. It also shows how to print the source code and the program output.

Note: To use JCreator, you must first have installed the Java 2 SDK from Sun Microsystems.

I. Creating a Java Class

1. Start JCreator

2. From the File menu, choose New and then File... (Or, click the New File button on the toolbar)

3. In the File Wizard dialog box, click on the File Type link to the left, click the Java Classes icon, and then click the Empty Java File icon. Click the Next button

4. In the File Path dialog box, enter a name for the file In the Name text box

• Do not enter a file extension – .java will automatically be added

• Remember that the file name must be the same as the class name, case-sensitive

5. Click on the Browse button to the right of the Location text box

6. Browse to find the folder in which to store the file and click OK, and then Finish

7. Type in your Java class and click the Save button on the toolbar

(Note that a Java file is saved automatically when the class is compiled)

III. Opening a Saved Class

To work with previously-saved Java classes, start JCreator, click the Open button on the toolbar, navigate to find the files, select them, and click Open

IV. Compiling a Class

1. Make sure the class is the active file by clicking on the file tab (just below the Menu bar)

2. Choose Build File from the Build Menu (or click the Build File button [(] on the toolbar)

3. The compilation results will appear in the Build Output window at the bottom of the screen

(To redisplay the Build Output window, if necessary, from the View menu choose Other Windows and then Build View)

4. If the compiler finds any syntax errors you will have to correct them and compile again before proceeding.

V. Correcting Syntax Errors

1. Double-click on each error message in the Build Output window to see the line where it occurred, and read the error description carefully and thoroughly

2. Continue correcting the syntax errors and re-compiling until there are no syntax errors

Tip: Scroll up in the Build Output window and correct the errors in the order they appear. Often, correcting an error near the beginning of a program will also fix many subsequent ones! (

VI. Running Your Program

1. Make sure your main class (i.e., the one with the main method) is active

2. Click the Run Project button [(] or choose Run Project (or Run File) from the Run menu, or just press [F5]

The program output will appear in the General Output window.

VII. Printing the Source Code (i.e., the .java file, aka: the program listing))

Make sure that the cursor is in the Program window (not the Build Output or General Output windows) and choose Print... from the File menu

VIII. Printing the Program Output (Using the Windows Clipboard)

1. In the General Output window, drag to select the output, right-click the selection, and choose Copy from the popup menu

2. Now open any word processor (Wordpad, Word, etc., but NOT Notepad) and click the Paste button

← Note: To preserve the same character spacing and indentation as in the output window, you may need to format the text in a monospace font, such as Courier New

Other than changing the font and size, do not edit the output in any way.

← You may also paste your output into the JCreator, either into a new empty file or at the bottom of one of your java files. If you paste output into a java file, remember to “comment it out” or the file will no longer compile

Lab Users Only – Security Procedures

1. When done, save your .java files to your flash drive or e-mail them to yourself

2. Delete all your files and folders – if any – from the system!

3. Restart the computer!

← Failure to follow these procedures may result in your work being stolen!

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download