Free and Easy Java

by Dave Mulkey, Germany, 2004
Dave_Mulkey@fis.edu


Testing JCreator Installation

Assuming you've installed and started JCreator, you'll see the following:

[Image]

Forget projects and workspaces for now - they'll be useful later.

  1. Create a new blank Java file.  Name it Warning.java .  Save it in a folder somewhere.
    [Image]
     
  2. Type in this program (or copy and paste it in).  

    import javax.swing.*; public class Warning extends JOptionPane { public static void main(String[] args) { new Warning(); } public Warning() { showMessageDialog(this,"Warning - Java is addictive"); System.exit(0); } }

    Make sure the name in  public class Warning  exactly matches the file name Warning.java (Java is case-sensitive). And be careful with all the punctuation marks - they are all required.  
     

  3. In the [Build] menu, click on [Compile File].
     
  4. If you have errors, they will appear in the "Build Output" window at the bottom:
    [Image]

    Each error message shows the line number and location of the error.
    If you click on the line number, that line will be highlighted in the source code.
    Fix errors one at a time, then compile again.  Often the first error causes multiple error messges.
    In the example, 3errors resulted from a single missing curly brace }.
     
  5. After a successful compile (no errors, Process Completed), click on [Build]/[Execute File]
    to run the program.  It will display a warning message.
    [Image]