Downloading JCreator

 Java Development Kit  J2Se 5.0 JDK  (or something more recent).

·  Download JDK before JCreator

   Be sure to look at the installation instructions.  Do change your “path” variable as instructed.

I take defaults on all choices. Then I extract the documentation J2SE 5.0 Documentation to the jdk1.5.0 directory (that the main installation uses)

The file (for most of my documentation needs) is then at jdk1.5.0\docs\api\index.html

Download the JCreator integrated environment. You can use any environment you like (including no environment), but this is my favorite.  This has no debugger.  JCreator Pro has a 30 day free trial.  It is nicer and does have a debugger.  You may as well use it, as we won’t be programming for longer than 30 days.

Jacobe Code Beautifer fixes indentation if you become expert or inherited UGLY code.  (Ignore this for now.)

USING JCreator TUTORIAL

 
JCreator LE  is a version of JCreator that you can download and install to your home computer for free.

Although the built in debugging is not available, some of the advantages of using JCreator LE are that JCreator is much faster and you can search the Java Docs and API from the help menu. This can be very useful for beginning Java programmers because the Java Docs describe aspects Java programming in detail and the API contains a listing of all the thousands of classes and methods already included and how to use them.

Step 1. Downloading and Installing JCreator

First you must downlaod the Java SDK.  Then, download JCreator and accept all defaults.

 

Step 2. STARTING JCreator

CLICK on the desktop icon for JCreator.

When the program starts, a "Tip of the day" window pops up. Read the tip, then close that window. You should now see this window.

.

 The two child windows on the left are the "File View" on the top left and the "Data View" on the side left.  You can open and close these windows with the “push pin” buttons above them on the right.

 
Step 3. Creating a New Java Project and Java File
To work with starter code, first create a directory for the starter code and extract everything to that directory.

 

You should create a project that will be associated with your Java program file. In JCreator, projects are created in Workspaces. When you create a new workspace, a folder is created to store your new project. A workspace can contain many projects.

CLICK File/ New...
The New dialog box will appear as shown. Select the Projects tab and click once on "Empty Project" to select it.

For this tutorial, name the project "Try".
Click on the “…” button next to the "Location" directory and browse to the location you wish to use.  Go to the location which contains the code you downloaded. CLICK FINISH


 

 

Now you should see a directory tree with your new workspace and your "Try" project listed in the top left File View window on your screen. Now you are ready to create a new Java program file to place in your project.

CLICK File/ New...

The same New dialog box appears. If you need to add other files, select the File tab and click once on the Java file to select it. Name your new file whatever you want and add it to the project you just created. You may have to browse to the directory of your new project to add it. The large main window will open your new file for editing. A plus sign should appear in the File View window next to your project. Click the plus sign to expand the tree and see your file as shown below.

 
You are now ready to write your first Java program using the JCreator IDE.

 

Step 4. ENTER JAVA CODE

You can now click on the starter code to see its contents.  Clicking on entries in the Data View window positions you to that declaration in the code.

Now your screen looks something like this.


Step 5. SAVING YOUR WORKSPACE
 

Whenever you add a file or project to a workspace you will need to save the changes to the workspace if you want those projects and files to remain associated with that workspace after you are done working on it. You should do this just before you close the workspace you are working in, but it is also good idea to save each time you add or remove files or projects from the workspace. If you do not save the workspace, the files will still be created in the workspace directory but they will not appear in the File View window and both new project files and source code files will need to be added next time you open the workspace. It is important to understand that when you save the workspace it does not save changes you make to the text of your program file. To save the changes in your program file you must either select Save All from the File menu or Compile the project or file which we will discuss in the next section. To save the current workspace:

CLICK File/ Save Workspace


Step 6. COMPILE & REPAIR
 

Before you can run your new program it must be compiled.

CLICK Build/ Compile Project (or the button or F7)

 
If the code was input correctly there should be a message in the Build Output box at the bottom reading “Process completed” as shown above. If your program does not Compile successfully, you probably have syntax errors. A description of the error will be shown in the Compile Messages box in place of the operation complete message. CLICK on the first line of the compile error message and there will be a red arrow next to the line of code in the text editing window where the error was encountered. Determine the reason for the error and correct it. Repeat this process until you have fixed all errors that appear in the Compile Messages box.  (Note:  The compile error message will show you where the compiler thinks the error is.  It may be before the given line. The message is often obscurely written.  As you program more, the error messages will become clearer to you.) You are now ready to run your new program.


Step 7. RUNNING YOUR PROGRAM

CLICK Build/ Execute Project  (F5) or Start Debugger (Ctrl F5).  Because both the .html file and the java file occur in the same directory, JCreator knows to use them together to run the applet.

Voila!  The output window should appear.  For the Liar’s dice game, after clicking “Play” we see:

You have completed creating and running your first Java program using JCreator.


Step 8. PRINTING YOUR PROGRAM  (if you should ever want to)
  Make sure your Edit window (the one containing the program) is active.  Click File/Print.../OK should do it.

Step 9.  PRINTING YOUR OUTPUT (if you should ever want to)

Make sure your output window is active by clicking on it.  Press Alt + PrintScreen.  Pressing Alt + PrintScreen will take a screen shot of the active window and place it on the clipboard.  Open Microsoft Word and Paste the image into it. This may be helpful in your report.

Step 10. CLOSING YOUR WORKSPACE

By clicking File on the menu bar you can choose to close the file you are working on, all files (if you are working with multiple files for your program), or the workspace you currently have loaded. If you have made changes to your workspace directory a dialog box will ask you if you want to save your changes when you attempt to close the workspace. To close your workspace:

CLICK File/ Close Workspace

Step 11. EXITING
 

You may exit the JCreator program by either clicking the windows close button (the 'x' icon at the top left of most windows) or:

CLICK File/ Exit

If you have made made any changes to your files or workspace, you will be prompted to save them before exiting.
 

Step 12. REOPENING A WORKSPACE IN JCreator

You may reopen a workspace by going to the directory of that workspace and clicking on the JCreator workspace file (extension .jcw). To open an existing workspace from the JCreator menu:

C LICK File/ Open Workspace...

Using the Open dialog box, browse to the directory of the workspace you wish to open and click the open button.

Step 13.  IMPORTING AN EXISTING FILE INTO A PROJECT

If you wish to add an existing source code file (extension .java) to the project you are working on:

CLICK Project/ Add Files...
 

Using the Add Files dialog box, browse to the directory of the file you wish to add and double click it. You should see the new file in the File View window associated with the project it was added to. The new file will also automatically be opened in the text editing window as shown below.

NOTE:  Adding a file to a project does not move the actual file, although the file has been added and can be used when compiling and running your program, it will still be in the same directory as it was before. If you want the file in the same directory as your new project (the workspace of your project) then you should move or copy the file to the that directory as you would any other file before adding it to your project.  (I think this is the best option.) 
 

DEBUGGING
 
 

The first thing you do when debugging is reread your program and think. Try to find the error by tracing the logic of your program by hand. The following can help, but it does not replace human thought.  Using the built in Java code "System.out.println( );" you can place messages in your program that will display helpful information while your program is running.  This method is a standard debugging tool that can be used whether you are programming with JCreator or not. "System.out" is a Java object and "println( )" a method of that object that will print whatever you place in the brackets to the default system output of your computer. The messages we have placed in our code using System.out.println will be displayed in the Debug Output window (at the bottom of the IDE) as we run our program. Compile and run the program  as you did before.

More advanced debugging features are available in the JCreator Pro version of the software that can be purchased and downloaded online. Although these features are extremely useful, they are beyond the scope of this tutorial.