Testing JCreator Installation
Assuming you've installed and started JCreator, you'll see the following:
Forget projects and workspaces for now - they'll be useful later.
-
Create a new blank Java file. Name it Warning.java . Save
it in a folder somewhere.
![[Image]](pict3.jpg)
-
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.
-
In the [Build] menu, click on [Compile File].
-
If you have errors, they will appear in the "Build Output" window at the
bottom:
![[Image]](pict6.jpg)
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 }.
-
After a successful compile (no errors, Process Completed), click on
[Build]/[Execute File]
to run the program. It will display a warning message.