JCreator IDE Tutorial

Intro to Object-oriented Programming with Java (COP 2551)

This lab activity demonstrates the basic steps involved in coding, compiling, executing, and testing a program in the JCreator LE Integrated Development Environment (IDE). (Version 4.5 was used for the instructions given.) If you have not already installed this software, see the instructions here.

  1. Start JCreator (Start > Programs > JCreator Pro > JCreator LE 4.5)

  2. Close the "Tip of the Day" window, if any.

  3. Open the File Wizard dialog box (File > New > File ...)

    1. For File Type select the Java classes category in the left panel, and Empty Java File in the right panel
    2. Click Next to specify the filename and path
    3. Type Lab1 for the filename; note that case (UPPER/lower) is very important in Java – make sure you type Lab1 , not lab1 or LAB1
    4. Navigate to the folder in which you want to save the file.
    5. Exit the File Wizard by clicking Finish

  4. The cursor should be positioned on line 1 in an edit window with the tab Lab1.java in the tab at the top of the window.

  5. Now you are ready to write the program. Use the normal Windows editing keys to type in the following multi-line comment (it should appear in green as you type):

        /* Lab1.java
         * Your Name
         *
         * Calculate how many dozens of eggs
         */

  6. Since this program uses input from the Scanner class, it will need to import the package; skip a line after the comment above and type:

        import java.util.Scanner;

  7. Now write the class definition for Lab1, by adding the code shown below. Use the normal Windows editing keys, and save your program periodically (File > Save). Pay close attention to case and punctuation. Don't be too concerned about what every line does – this is what we'll be learning in class. The completed program should look like:

/* Lab1.java
 * Your Name
 * 2006-09-11
 *
 * Calculate how many dozens of eggs
 */

import java.util.Scanner;

public class Lab1
{
    public static void main( String[] args )
    {
        Scanner input = new Scanner(System.in);
       
        int eggs;       // number of eggs
        int dozens;     // whole dozens
        int leftOver;   // eggs left over

        System.out.print("How many eggs do you have? ");
        eggs = input.nextInt();

        dozens = eggs / 12;
        leftOver = eggs % 12;
 
        System.out.printf("\nThat's %d dozens, ", dozens);
        System.out.printf("%d left over.\n\n", leftOver);

    } // end main()
} // end Lab1
  1. When you have finished coding the program, save it, and compile it (Build > Build File).

  2. If you typed the above program perfectly, the bottom window will display the message Process completed. (If the window disappears, you can bring it back by clicing on the "Build Output" tab at the botom of the window.) If you have syntax errors, your program needs to be fixed before it can be run. To do this:

    1. Scroll in the bottom window to display the first syntax error.
    2. Double-click anywhere in the line that explains the error. In the Edit window, an indicator will show you in which line of your program the compiler first realized there is a problem with your syntax. The actual syntax error may be in this line, the line above it, or somewhere else in the program.
    3. Read the explanation of the error and compare your typed line with the program listing above. Identify and correct the error.

    4. Save the program, recompile, and repeat until all syntax errors have been corrected.

  3. Run your program (Run > Run File).

  4. The program will run in the General Output window at the bottom of the screen. Type your input as requested by the prompt. Your program will accept this data, and compute and display the result and the message Process completed. (If the window disappears, you can bring it back by clicking on the "General Output" tab at the bottom.) This program should work fine, but usually you will find logic errors in it that will need to be corrected by repeated analysis, editing, compiling, and testing.

  5. When you are finished save your final product and exit JCreator from the File menu. 

 Updated: 2008-05-13