Java Technology  «Prev  Next»

Compiling Java Applet - Exercise

Compiling the Java source code file TicTacToe.java will generate a file named TicTacToe.class, which is referenced from the Web page TicTacToe.html. You should be able to play a game of Tic-Tac-Toe in this Web page if you properly compile the applet.
Enter the command:
javac TicTacToe.java
After you hit Enter, the compiler will look at the code contained within the TicTacToe.java file, and attempt to compile it. If the compiler cannot, it will display a series of errors to help you fix the code. The applet has been compiled successfully if you are returned to the command prompt without any messages. If that is not the case, go back and check the code you have written.
Make sure it matches the example code and re-save the file. Keep doing this until you can run javac without getting any errors. Once the applet has been successfully compiled, you will see a new file in the same directory.
It will be called TicTacToe.class.