Compiling and running Java programs with BlueJ

advertisement
Compiling and running Java
programs with BlueJ
Successfully compiled files program files in
BlueJ
• You can tell from the shade of a program icon in BlueJ
whether the program has been successfully compiled
(translated)
Successfully compiled files program files in
BlueJ (cont.)
• Icon shades:
• Shaded: this program has not been compiled successfully
Successfully compiled files program files in
BlueJ (cont.)
•Unshaded: this program has been compiled successfully
Compiling (translating) your Java program
with BlueJ
• You can compile (= translate) a Java program in BlueJ in
2 different ways:
Compiling (translating) your Java program
with BlueJ (cont.)
1. From BlueJ's editor window:
Left click on the Compile button
Compiling (translating) your Java program
with BlueJ (cont.)
2. From BlueJ's main window:
Right click on the program file and then left click of the
Compile menu button
Compiling (translating) your Java program
with BlueJ (cont.)
• When the program is compiled successfully, the icon in the
main window (associated with the program) become
unshaded:
Running a (successfully compiled) Java
program with BlueJ
• Execute a Java program in BlueJ:
1. Right click on the program file in BlueJ's main window,
and then
2. Left click on the void main(String[]args) tab:
Running a (successfully compiled) Java
program with BlueJ (cont.)
3. A window will pop up:
Left click on OK to run the program.
Running a (successfully compiled) Java
program with BlueJ (cont.)
Result: the output of the program is shown in BlueJ's
"terminal" window:
Download