ptg7068951
378 APPENDIX A: Using the NetBeans Integrated Development Environment
Running the Application
After you’ve created theJava class Spartacus.javaand compiled it suc-
cessfully, you can run it within NetBeans in two ways:
. Choose Run, Run File from the menu.
. Right-click Spartacus.javain the Projects pane, and choose Run
File.
When you run a Java class, its main()method is called by the compiler.
The string “I am Spartacus!” appears in the Output pane, as shown in
Figure A.4.
FIGURE A.4
Output of the Spartacus
application.
A Java class must have a main()method to be run. If you attempt to run a
class that lacks one, NetBeans responds with an error.
Fixing Errors
Now that the Spartacus applicationhas been written, compiled, and run,
it’s time to break something to get some experience with how NetBeans
responds when things go terribly wrong.